MPMediaPropertyPredicate Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/MediaPlayer.framework |
| Availability | Available in iOS 3.0 and later. |
| Companion guide | |
| Declared in | MPMediaQuery.h |
Overview
Use one or more MPMediaPropertyPredicate objects, or media property predicates, to define the filter in a media query to retrieve a subset of media items from the iPod library. A predicate in this context is a statement of a logical condition that you want to test each media item against. Those items that satisfy the condition are retrieved in the query result.
You define iPod library queries, and retrieve query results, using the MPMediaQuery class, described in MPMediaQuery Class Reference. The media items and media item collections that you retrieve with a query are described in MPMediaItem Class Reference and MPMediaItemCollection Class Reference.
Tasks
Creating Media Property Predicates
Examining Media Property Predicates
-
propertyproperty -
valueproperty -
comparisonTypeproperty
Properties
comparisonType
The type of matching comparison that the media property predicate performs when you invoke a query.
Discussion
For comparison types, see “Media Property Predicate Comparison Types.”
Availability
- Available in iOS 3.0 and later.
Declared In
MPMediaQuery.hproperty
The property that the media property predicate uses when you invoke a query.
Availability
- Available in iOS 3.0 and later.
Declared In
MPMediaQuery.hvalue
The value that the media property predicate matches against when you invoke a query.
Availability
- Available in iOS 3.0 and later.
Declared In
MPMediaQuery.hClass Methods
predicateWithValue:forProperty:
Creates a media property predicate with the default comparison type.
Parameters
- predicateWithValue:
The property value that you want to match when you query the iPod library. For example, if you specify the
MPMediaItemPropertyArtistconstant in the forProperty parameter, in this parameter you supply a string containing the artist name.- forProperty:
A so-called filterable property—one that can be used to build a media property predicate. See
General Media Item Property KeysandPodcast Item Property Keysin MPMediaItem Class Reference.
Return Value
A media property predicate.
Discussion
This is a convenience method that uses the default logical comparison type of MPMediaPredicateComparisonEqualTo.
Availability
- Available in iOS 3.0 and later.
Declared In
MPMediaQuery.hpredicateWithValue:forProperty:comparisonType:
Creates a media property predicate with a specified comparison type.
Parameters
- predicateWithValue:
The property value that you want to match when you query the iPod library. For example, if you specify the
MPMediaItemPropertyArtistconstant in the forProperty parameter, in this parameter you supply a string containing the artist name.- forProperty:
A so-called filterable property—one that can be used to build a media property predicate. See
General Media Item Property KeysandPodcast Item Property Keysin MPMediaItem Class Reference.- comparisonType:
The logical comparison type for the predicate. See “Media Property Predicate Comparison Types.”
Return Value
A media property predicate.
Availability
- Available in iOS 3.0 and later.
See Also
Declared In
MPMediaQuery.hConstants
Media Property Predicate Comparison Types
Logical comparison types for media queries.
enum {
MPMediaPredicateComparisonEqualTo,
MPMediaPredicateComparisonContains
};
typedef NSInteger MPMediaPredicateComparison;
Constants
MPMediaPredicateComparisonEqualToMatches when a media item’s value for a given property is equal to the value in the media property predicate.
Available in iOS 3.0 and later.
Declared in
MPMediaQuery.h.MPMediaPredicateComparisonContainsMatches when a media item’s value for a given property is contained in the value of the media property predicate.
Available in iOS 3.0 and later.
Declared in
MPMediaQuery.h.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-10-19)