私はチュートリアルに従っていました: http://www.devx.com/wireless/Article/43374 そのため、曲の UITableView にアルファベットの並べ替えとパンを追加でき、コーディングは完了しましたが、この方法に従っていると、UITableView が遅くなります。 cellForRowAtIndexPath メソッドで配列をフィルタリングし、値を取得します。余分なコーディングを削除して速度を上げる方法がわかりません。すべての MPMediaItems は tableTracks 配列に格納されます。viewDidLoad で初期化されます。そして、musicIndex はアルファベット (各曲の最初の文字) の配列です。MPMediaItem を拡張して、曲の最初の文字である NSString firstLetter を含めました。
それをスピードアップする助けはありますか?
-(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;
}