iphone - Alternate way to get object based on indexPath in UITableView -
i next tutorial: http://www.devx.com/wireless/article/43374 add together alphabet sorting , panning uitableview of songs , have finished coding method have followed slows downwards uitableview filtering arrays , retrieving values in cellforrowatindexpath method. cant figure out how can remove excess coding increment speed. mpmediaitems stored in tabletracks array. initialized in viewdidload. , thee musicindex array of alphabets(first letter of each song). extended mpmediaitem include nsstring firstletter first letter of song.
any help speeding up?
-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ //--create cell--\\ ......... //--load info--\\ nsstring *alphabet = [musicindex objectatindex:[indexpath section]]; nspredicate *predicate = [nspredicate predicatewithformat:@"firstletter beginswith[c] %@", alphabet]; nsarray *songs = [tabletracks filteredarrayusingpredicate:predicate]; //needed object mpmediaitem *item = [songs objectatindex:indexpath.row]; //--rest of method--\\ ........... homecoming cell; }
if showing separate sections, 1 each letter of alphabet, create array of dictionaries data, in viewdidload, not here. dictionaries have first letter of song key, , array of songs value. way, filtering , sorting done front, rather in each row table populated.
iphone objective-c xcode uitableview mpmediaitem
No comments:
Post a Comment