我试图发挥MPMedaiItem在MPMusicPlayerControlleriOS中.在我的情况下,我有一个UITableView播放播放列表中的歌曲.当我点按相机时UITableView,我想要播放那首歌MPMusicPlayerController.当我点击下一步按钮时,我还想跳过播放列表中的下一首歌曲.我该怎么玩?
以下是我在didSelectedMethod of 中编写的一些代码UITableView.那不起任何作用.
MPMediaItemCollection *songs = [self.arrayOfSongs objectAtIndex:indexPath.row ];
MPMediaItem *item = [songs representativeItem ];
NSLog(@"%@",[item valueForProperty:MPMediaItemPropertyTitle ]);
[self.player setNowPlayingItem:[item valueForProperty:MPMediaItemPropertyAssetURL]];
[self.player play ];
Run Code Online (Sandbox Code Playgroud) 您好我正在尝试使用以下代码在iOS中检索带有MPMediaQuery的Artist.
在我的ViewDidL enter code hereOAD
MPMediaQuery *query = [MPMediaQuery artistsQuery];
self.arrayOfArtist = [query collections];
Run Code Online (Sandbox Code Playgroud)
在我的 cellForRowAtIndexPath
cell.textLabel.text = [NSString stringWithFormat:@"%@",[[self.arrayOfArtist objectAtIndex:indexPath.row] valueForProperty:MPMediaItemPropertyArtist]];
Run Code Online (Sandbox Code Playgroud)
当我查询时NSLog,我的arrayOfArtist数量约为330.
但是在我看来UITableView,这只是表演NULL.
我有什么不对的吗?
您好我现在正在从iOS的文档目录中检索文件.
我也是由CreationDate排序的文件.
在我的文档目录中,它还有很多文件夹和文件.
因此,当我从文档目录中检索所有文件时,该文件夹名称也包括在内.
我只想检索(.txt)格式文件.
我怎样才能做到这一点?
我想在iOS中添加UILabel背后的更多文字.
在其他语言中,我们可以添加以下内容:
String s += textBox.text;
Run Code Online (Sandbox Code Playgroud)
我们可以使用(+ =)签到其他语言.
在Objective-C中,我不知道如何添加到标签中.
请帮我.
当我存档我的应用程序以上传到应用程序商店时,应用程序图标为白色.但是在Xcode 4.2中一切都还可以.在Xcode 4.3.2中,app图标在归档后变为白色.Xcode允许上传到应用程序商店,没有任何警告和错误.上传完成并等待审核.我想知道,如果Apple会拒绝我的应用程序吗?
我试图MPMediaQuery在iOS中从iPod库中检索播放列表.我想展示一下UITableView.
这是我的代码viewDidLoad.
MPMediaQuery *myQuery = [[MPMediaQuery alloc] init];
[myQuery setGroupingType: MPMediaGroupingPlaylist];
arrayOfPlaylist = [myQuery collections];
Run Code Online (Sandbox Code Playgroud)
在UITableViewCell方法中
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
for(int i=0;i<self.arrayOfPlaylist.count;i++)
{
dic = [self.arrayOfPlaylist objectAtIndex:0];
cell.textLabel.font = [UIFont systemFontOfSize:10];
cell.textLabel.text = [NSString stringWithFormat:@"%@",[self.arrayOfPlaylist objectAtIndex:indexPath.row]];
}
return cell;
Run Code Online (Sandbox Code Playgroud)
在我写完上面的代码之后,UITableView我只收到了以下消息:
<MPConcreteMediaPlaylist : 0x1e51afd0>
Run Code Online (Sandbox Code Playgroud)
我不知道那是什么以及如何将播放列表名称转换为字符串.当我用NSLog方法测试时,我的播放列表计数是正确的.
但是我只收到了上面的消息而没有播放列表名称UITableView.
我只是iOS的初学者.
请帮我显示播放列表UITableView …
当我点击下面的图片时,我正在尝试突出显示自定义UIButton.

我想像上面的图像一样传播白光.
我需要使用的任何财产?
谢谢.
我在stackoverflow中发现了很多关于NSTimer在后台运行的帖子.
但是我找不到任何解决方案.
在我的应用程序中,我在后台播放声音,并设置计时器以在达到该时间时停止音乐.
所以我需要运行我的NSTimer背景(意味着当主页按钮点击并睡眠iPhone).
我怎样才能做到这一点?
我需要在UISearchBar中设置我的自定义inputView.
所以我写了以下代码,这在iOS5和iOS6中完美运行.
但它在iOS7中不起作用.
for(int i =0; i<[self.searchBar.subviews count]; i++) {
if([[self.searchBar.subviews objectAtIndex:i] isKindOfClass:[UITextField class]])
{
[(UITextField*)[searchBar.subviews objectAtIndex:i] setFont:[UIFont fontWithName:@"MyCustomFont" size:15]];
UITextField* search=(UITextField*)[searchBar.subviews objectAtIndex:i];
search.delegate = self;
[(UITextField*)[self.searchBar.subviews objectAtIndex:i] setInputView:self.customKeyboard];
[self.customKeyboard setTextView:search];
}
}
[self.sBar reloadInputViews];
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我需要检索的名单Contacts在iOS.
这是我的代码不起作用.
NSMutableArray *myContacts = [[NSMutableArray alloc]init];
CFErrorRef error = NULL;
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
if (addressBook!=nil)
{
NSArray *allContacts = (__bridge_transfer NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
NSUInteger i = 0;
for (i = 0; i<[allContacts count]; i++)
{
Person *person = [[Person alloc] init];
ABRecordRef contactPerson = (__bridge ABRecordRef)allContacts[i];
NSString *firstName = (__bridge_transfer NSString*)ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty);
person.firstName = firstName;
[myContacts addObject:person];
}
CFRelease(addressBook);
}
else
{
NSLog(@"Error");
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到这份清单Contacts?
ios ×10
cocoa-touch ×4
iphone ×2
mpmediaquery ×2
objective-c ×2
addressbook ×1
app-store ×1
audio ×1
inputview ×1
ios7 ×1
nstimer ×1
uibutton ×1
uilabel ×1
uisearchbar ×1
uitableview ×1
upload ×1
xcode4.3 ×1