0
我正在遵循教程:http://www.devx.com/wireless/Article/43374 所以我可以添加字母排序和平移到我的UITableView的歌曲和我已经完成编码,但是我已经跟随这种方法减慢UITableView由过滤数组并检索cellForRowAtIndexPath方法中的值。 我不知道如何删除多余的编码来提高速度。所有MPMediaItem都存储在tableTracks数组中。它在viewDidLoad中初始化。 musicIndex是字母数组(每首歌的第一个字母)。我扩展了MPMediaItem以包含歌曲首字母的NSString firstLetter。另一种方式来获取对象基于IndexPath在UITableView
任何帮助加快速度?
-(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--\\
...........
return cell;
}
谢谢!你说的是什么,注意到速度有很大的不同! – kezi 2013-02-09 21:25:49