ios - MPMediaQuery not showing name in cell text label -
i have playlist query shows playlists, , supposed print them text label in cell. however, don't see text displayed on cell.
i have nslog shows playlist name. help? code follows.
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; mpmediaquery *myplaylistsquery = [mpmediaquery playlistsquery]; nsarray *playlists = [myplaylistsquery collections]; mpmediaitem *rowitem = [[playlists objectatindex:indexpath.row] representativeitem]; cell.textlabel.text = [rowitem valueforproperty:mpmediaplaylistpropertyname]; (mpmediaplaylist *playlist in playlists) { nslog (@"%@", [playlist valueforproperty: mpmediaplaylistpropertyname]); } return cell; }
any guesses why cells aren't showing names? have text black on white cells. alpha 1.0
it looks you'll need assign playlist object collection, instead of mpmediaitem object. verify, try printing object cell created:
nslog (@"%@", [playlistitem valueforproperty: mpmediaplaylistpropertyname]);
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; mpmediaquery *myplaylistsquery = [mpmediaquery playlistsquery]; nsarray *playlists = [myplaylistsquery collections]; mpmediaplaylist *playlistitem = [playlists objectatindex:indexpath.row]; nslog (@"%@", [playlistitem valueforproperty: mpmediaplaylistpropertyname]); cell.textlabel.text = [playlistitem valueforproperty:mpmediaplaylistpropertyname]; (mpmediaplaylist *playlist in playlists) { nslog (@"%@", [playlist valueforproperty: mpmediaplaylistpropertyname]); } return cell; }
Comments
Post a Comment