在我的应用程序中,我必须制作音乐库.所以我必须从音乐库中获取歌曲.我完成了直到这个再见.
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
我正在寻找IOS应用程序中的文件处理.我在Google上挖掘了很多东西,我发现word文件是基于OOXML的.iOS有可能遵循这种格式.如果有人有想法,请转介我.
然后我试图找到另一种方式来改变.doc文件的样式.我发现,我们可以在.html文件中使用JavaScripts在UIWebView中执行此类操作.但仍然没有得到如何在.doc中存储这个.html文件.
如果有人对字处理器有所了解,那么请指导我在目标C中如何实现任何帮助.
谢谢,
嘿我是目标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) 我得到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)