我试图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 …