查询ipod库播客,并按作者/标题对其进行排序

时间:2013-08-26 14:27:40

标签: ios nspredicate mpmediaitem mpmediaquery

我有两种方法可以为我提取iPod库的内容。我仍然不熟练使用这些类。例如,现在我将获得图书馆中所有播客的播客标题,但如果我想设置谓词和查询以获取作者/播客标题的各个播客,我将如何做到。

/* Delegate
 * Set which media type to get */
- (MPMediaPropertyPredicate *)mediaTypeToFetchFromiPodLibrary: (AbstractTVC *) sender;
{
     MPMediaPropertyPredicate *abPredicate =
     [MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithInt:MPMediaTypePodcast]
     forProperty:MPMediaItemPropertyMediaType];
    return abPredicate;
}


/* Overriden abstract method from subclass
 * */
- (MPMediaQuery *)setMediaQueryOptions: (MPMediaQuery*)abQuery
                         withPredicate: (MPMediaPropertyPredicate*) abPredicate
{
    [abQuery addFilterPredicate:abPredicate];
    //[abQuery setGroupingType:MPMediaGroupingAlbum];
    [abQuery setGroupingType:MPMediaGroupingPodcastTitle];
    return abQuery;
}

0 个答案:

没有答案