Class: MPMediaQuery
Overview
A media query specifies a set of media items (instances of MPMediaItem) from the iPod library by way of a filter and a grouping type. Filter and grouping type are both optional; an unqualified query matches the entire library.
Instance Attribute Summary (collapse)
-
- collections
readonly
An array of media item collections whose contained items match the query’s media property predicate.
-
- collectionSections
readonly
An array of MPMediaQuerySection instances representing the section grouping of the query's specified media item collections.
-
- filterPredicates
The media property predicates of the media query.
-
- groupingType
The grouping for collections retrieved with the media query.
-
- items
readonly
An array of media items that match the media query’s predicate.
-
- itemSections
readonly
An array of MPMediaQuerySection instances representing the section grouping of the query's specified media items.
Class Method Summary (collapse)
-
+ albumsQuery
Creates a media query that matches music items and that groups and sorts collections by album name.
-
+ artistsQuery
Creates a media query that matches music items and that groups and sorts collections by artist name.
-
+ audiobooksQuery
Creates a media query that matches audio book items and that groups and sorts collections by audio book name.
-
+ compilationsQuery
Creates a media query that matches compilation items and that groups and sorts collections by album name.
-
+ composersQuery
Creates a media query that matches all media items and that groups and sorts collections by composer name.
-
+ genresQuery
Creates a media query that matches all media items and that groups and sorts collections by genre name.
-
+ playlistsQuery
Creates a media query that matches the entire iPod library and that groups and sorts collections by playlist name.
-
+ podcastsQuery
Creates a media query that matches podcast items and that groups and sorts collections by podcast name.
-
+ songsQuery
Creates a media query that matches music items and that groups and sorts collections by song name.
Instance Method Summary (collapse)
-
- addFilterPredicate:
Adds a media property predicate to a query.
-
- init
Initializes a generic media query.
-
- initWithFilterPredicates:
Initializes a media query with a set of media property predicates.
-
- removeFilterPredicate:
Removes a filter predicate from a query.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (Array) collections (readonly)
An array of media item collections whose contained items match the query’s media property predicate. The returned array of collections are grouped and sorted by the groupingType of the media query. The following code snippet illustrates how to use this property:Each element of the collections array now contains a media item collection. Each collection contains the media items from the iPod library by a particular artist. The elements of the array are sorted by artist name.For the available grouping types, see “Media Item Collection Grouping Keys.”
- (Array) collectionSections (readonly)
An array of MPMediaQuerySection instances representing the section grouping of the query's specified media item collections. The value of this property may be nil if there is no appropriate section grouping of the media item collections.
- (NSSet) filterPredicates
The media property predicates of the media query. The General Media Item Property Keys and Podcast Item Property Keys enumerations in MPMediaItem Class Reference contain the keys you can use to construct predicates.
- (MPMediaGrouping) groupingType
The grouping for collections retrieved with the media query. The default grouping type is MPMediaGroupingTitle. See “Media Item Collection Grouping Keys” for the list of available grouping types.
- (Array) items (readonly)
An array of media items that match the media query’s predicate. If no items match the predicate, this method returns an empty array. On error, returns nil.
- (Array) itemSections (readonly)
An array of MPMediaQuerySection instances representing the section grouping of the query's specified media items. The value of this property may be nil if there is no appropriate section grouping of the media items.
Class Method Details
+ (MPMediaQuery) albumsQuery
Creates a media query that matches music items and that groups and sorts collections by album name. A media item can have more than one media type; for example, an item could be of types “music” and “podcast.” An albumsQuery query matches all MPMediaTypeMusic items, whether or not they are also of other media types.
+ (MPMediaQuery) artistsQuery
Creates a media query that matches music items and that groups and sorts collections by artist name. A media item can have more than one media type; for example, an item could be of types “music” and “podcast.” An artistsQuery query matches all MPMediaTypeMusic items, whether or not they are also of other media types.
+ (MPMediaQuery) audiobooksQuery
Creates a media query that matches audio book items and that groups and sorts collections by audio book name. A media item can have more than one media type; for example, an item could be of types “music” and “podcast.” An audiobooksQuery query matches all MPMediaTypeAudioBook items, whether or not they are also of other media types.
+ (MPMediaQuery) compilationsQuery
Creates a media query that matches compilation items and that groups and sorts collections by album name. A media item can have more than one media type; for example, an item could be of types “music” and “podcast.” A compilationsQuery query matches all media items that have the MPMediaItemPropertyIsCompilation property, irrespective of their media types.
+ (MPMediaQuery) composersQuery
Creates a media query that matches all media items and that groups and sorts collections by composer name.
+ (MPMediaQuery) genresQuery
Creates a media query that matches all media items and that groups and sorts collections by genre name.
+ (MPMediaQuery) playlistsQuery
Creates a media query that matches the entire iPod library and that groups and sorts collections by playlist name.
+ (MPMediaQuery) podcastsQuery
Creates a media query that matches podcast items and that groups and sorts collections by podcast name. A media item can have more than one media type; for example, an item could be of types “music” and “podcast.” A podcastsQuery query matches all MPMediaTypePodcast items, whether or not they are also of other media types.
+ (MPMediaQuery) songsQuery
Creates a media query that matches music items and that groups and sorts collections by song name. A media item can have more than one media type; for example, an item could be of types “music” and “podcast.” A songsQuery query matches all MPMediaTypeMusic items, whether or not they are also of other media types.
Instance Method Details
- (Object) addFilterPredicate(predicate)
Adds a media property predicate to a query.
- (Object) init
Initializes a generic media query. A generic media query has no filter predicates and no grouping configuration. It matches everything in the iPod library and provides no grouping or sorting.
- (Object) initWithFilterPredicates(filterPredicates)
Initializes a media query with a set of media property predicates. MPMediaPropertyPredicate Class Reference describes how to create media property predicates. The General Media Item Property Keys and Podcast Item Property Keys enumerations in MPMediaItem Class Reference contain the keys you can use to construct predicates.
- (Object) removeFilterPredicate(predicate)
Removes a filter predicate from a query.