NSMetadataQueryDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in iOS 5.0 and later.
Companion guide
Declared in
NSMetadata.h

Overview

The NSMetadataQueryDelegate protocol defines the optional methods implemented by delegates of NSMetadataQuery objects.

Tasks

Getting Query Results

Instance Methods

metadataQuery:replacementObjectForResultObject:

Implemented by the delegate to return a different object for a specific query result object.

- (id)metadataQuery:(NSMetadataQuery *)query replacementObjectForResultObject:(NSMetadataItem *)result
Parameters
query

The query that produced the result object to replace.

result

The query result object to replace.

Return Value

Object that replaces the query result object.

Discussion

By default query result objects are instances of the NSMetadataItem class. By implementing this method, you can return an object of a different class type for the specified result object.

Availability
  • Available in iOS 5.0 and later.
Declared In
NSMetadata.h

metadataQuery:replacementValueForAttribute:value:

Implemented by the delegate to return a different value for a specific attribute.

- (id)metadataQuery:(NSMetadataQuery *)query replacementValueForAttribute:(NSString *)attribute value:(id)attributeValue
Parameters
query

The query that produced the result object with attribute.

attribute

The attribute in question.

attributeValue

The attribute value to replace.

Return Value

Object that replaces the value of attribute in the result object

Discussion

The delegate implementation of this method could convert specific query attribute values to other attribute values, for example, converting date object values to formatted strings for display.

Availability
  • Available in iOS 5.0 and later.
Declared In
NSMetadata.h