小编AJP*_*tel的帖子

从音乐库中获取歌曲列表后如何播放音乐文件?

在我的应用程序中,我必须制作音乐库.所以我必须从音乐库中获取歌曲.我完成了直到这个再见.

Test_MusicLibraryAppDelegate *appDeleg = (Test_MusicLibraryAppDelegate *)[[UIApplication sharedApplication]delegate];

    //NSMutableDictionary *musicList = [NSMutableDictionary dictionary]; 

    MPMediaQuery *query = [[MPMediaQuery alloc] init];
    [query addFilterPredicate:[MPMediaPropertyPredicate
                               predicateWithValue:[NSNumber numberWithInteger:(MPMediaTypeMusic)]
                               forProperty:MPMediaItemPropertyMediaType]];

    for (MPMediaItem* item in [query items]) { 
        [appDeleg.arryMusic addObject:item];
    }

    NSLog(@"Count :: %d ",[appDeleg.arryMusic count]);
    [query release];
Run Code Online (Sandbox Code Playgroud)

而不是在表视图中显示它.

当我必须在所选索引上播放歌曲时,我会获取歌曲名称但不知道如何播放该歌曲,

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    Test_MusicLibraryAppDelegate *appDeleg = (Test_MusicLibraryAppDelegate *)[[UIApplication sharedApplication]delegate];

//      MPMediaItem *song = [appDeleg.arryMusic objectAtIndex:indexPath.row];

    NSURL *aURL = [appDeleg.arryMusic objectAtIndex:indexPath.row];
    //[song valueForProperty:MPMediaItemPropertyAssetURL];
    [[self avPlayer] replaceCurrentItemWithPlayerItem:
     [AVPlayerItem playerItemWithURL:aURL]];
    [avPlayer play];
}
Run Code Online (Sandbox Code Playgroud)

但我的声音文件不会播放...

嘿,任何人都知道这个比帮助我..

谢谢AJPatel

iphone avaudioplayer ios

3
推荐指数
1
解决办法
2163
查看次数

如何在iOS应用程序中创建.doc文件或文字处理器?

我正在寻找IOS应用程序中的文件处理.我在Google上挖掘了很多东西,我发现word文件是基于OOXML的.iOS有可能遵循这种格式.如果有人有想法,请转介我.


然后我试图找到另一种方式来改变.doc文件的样式.我发现,我们可以在.html文件中使用JavaScripts在UIWebView中执行此类操作.但仍然没有得到如何在.doc中存储这个.html文件.


如果有人对字处理器有所了解,那么请指导我在目标C中如何实现任何帮助.

谢谢,

objective-c openxml ios

3
推荐指数
1
解决办法
4499
查看次数

如何在触摸事件上绘制线条?

嘿我是目标C的初学者请帮助我

我制作以下代码但不工作.....

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

UITouch *touch = [touches anyObject];
if ([touch view] == self.view) {

    CGPoint location = [touch locationInView:self.view];
    loc1 = location;
    CGContextMoveToPoint(context, location.x, location.y);
    NSLog(@"x:%d y:%d At Touch Begain", loc1.x, loc1.y);
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

{
    UITouch *touch = [touches anyObject];

        if ([touch view] == self.view) 
    {
    CGPoint location = [touch locationInView:self.view];
    CGContextMoveToPoint(context, loc1.x, loc1.y);
    NSLog(@"x:%d y:%d At Touch Move", loc1.x, loc1.y);
    CGContextAddLineToPoint(context, location.x, location.y);
    NSLog(@"x:%d y:%d", location.x, location.y);
}

} …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios4

2
推荐指数
1
解决办法
8714
查看次数

如何在应用程序中使用Base64算法?

我得到Base64算法.从谷歌比我转换该字符串通过调用如下...字符串转换数据,但在UIImage视图我得到0*0什么是问题...

NSData *data = [[NSData alloc] init];

data = [self dataFromBase64EncodedString:@"aHR0cDovL3d3dy5uZHJvaWQzNjAuY29tL2dwcy91c2VyX3Bob3RvL25vaW1hZ2VfdG4uanBlZw=="];

UIImage *img = [UIImage imageWithData:data];

myImage.image = img;
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios4

0
推荐指数
1
解决办法
208
查看次数

标签 统计

iphone ×3

objective-c ×3

ios ×2

ios4 ×2

avaudioplayer ×1

openxml ×1