我需要按字母顺序排序ipod队列。
使用以下代码,歌曲不按字母顺序排列
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
everything = [MPMediaQuery songsQuery];
[musicPlayer setQueueWithQuery:everything];
[self.musicPlayer play]
使用以下代码,歌曲按字母顺序排序,但加载
需要60秒以上MPMediaQuery *everything = [[MPMediaQuery alloc] init];
everything = [MPMediaQuery songsQuery];
[everything setGroupingType: MPMediaGroupingTitle];
NSArray *collections = [everything collections];
MPMediaItemCollection *firstCollection = [collections
objectAtIndex:0];
NSMutableArray *combinedMediaItems = [[firstCollection items]
mutableCopy];
for(int i = 1; i < [collections count]; i++) {
NSArray *newMediaItems = [[collections objectAtIndex:i] items];
[combinedMediaItems addObjectsFromArray: newMediaItems];
}
[self.musicPlayer setQueueWithItemCollection: [MPMediaItemCollection
collectionWithItems: (NSArray *) combinedMediaItems]];
[self.musicPlayer play];
你能帮帮我吗?感谢。