将mediaItemCollection数据放置在UITableView中
我需要一些帮助来将将mediaItemCollection数据放置在UITableView中,uitableview,xcode4,mpmediaitemcollection,Uitableview,Xcode4,Mpmediaitemcollection,我需要一些帮助来将mediaItemCollection数据放置在UITableView中 代码: mediaItemCollection是我需要放入我的UITableView: 通过声明MPMediaItemCollection并设置其内容,我可以在更新UITableView的数据时读取mediaItemCollection - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInde
mediaItemCollection
数据放置在UITableView
中
代码:
mediaItemCollection
是我需要放入我的UITableView
:
通过声明MPMediaItemCollection
并设置其内容,我可以在更新UITableView
的数据时读取mediaItemCollection
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"song_cell"];
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:@"song_cell"];
MPMediaItem *anItem = [[collection items] objectAtIndex:indexPath.row];
cell.textLabel.text = [anItem valueForProperty:MPMediaItemPropertyTitle];
cell.detailTextLabel.text = [anItem valueForProperty:MPMediaItemPropertyArtist];
[tableView reloadData];
}
:)
通过声明MPMediaItemCollection
并设置其内容,我可以在更新UITableView
的数据时读取mediaItemCollection
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"song_cell"];
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:@"song_cell"];
MPMediaItem *anItem = [[collection items] objectAtIndex:indexPath.row];
cell.textLabel.text = [anItem valueForProperty:MPMediaItemPropertyTitle];
cell.detailTextLabel.text = [anItem valueForProperty:MPMediaItemPropertyArtist];
[tableView reloadData];
}