ios - Sorting UITableView -


i want basic sorting of uitableview generated mpmediaquery.

what want have basic songs list sorts songs sections of a, b, c, d, etc. shouldn't hard, every tutorial i've tried follow ends no giving me results @ all.

any wonderful. here basic code. realize not close having want accomplished, figured easier seasoned developer me point mess in.

how generate data:

mpmediaquery *musiclibraryquery = [[mpmediaquery alloc] init]; nsarray *musiclibraryarray = [musiclibraryquery items]; songlibrary = [nsmutablearray arraywitharray:musiclibraryarray]; 

these uitableview methods:

- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return [songlibrary count]; }  - (uitableviewcell *) tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @"songcell";      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];      if(!cell)     {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }      mpmediaitem *song = [[songlibrary objectatindex:[indexpath row]] representativeitem];      cell.textlabel.text = [song valueforproperty:mpmediaitempropertytitle];      return cell; } 

u need sort array example


songlibrary = [musiclibraryarray sortedarrayusingselector:@selector(caseinsensitivecompare:)]; 



Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -