Instance Method

annotationsInMapRect:

Returns the annotation objects located in the specified map rectangle.

Declaration

- (NSSet<id<MKAnnotation>> *)annotationsInMapRect:(MKMapRect)mapRect;

Parameters

mapRect

The portion of the map that you want to search for annotations.

Return Value

The set of annotation objects located in mapRect.

Discussion

This method offers a fast way to retrieve the annotation objects in a particular portion of the map. This method is much faster than doing a linear search of the objects in the annotations property yourself.

Special Considerations

Prior to iOS 7 this method incorrectly did not return instances of MKUserLocation.

See Also

Annotating the Map

annotations

The complete list of annotations associated with the receiver.

- addAnnotation:

Adds the specified annotation to the map view.

- addAnnotations:

Adds an array of annotation objects to the map view.

- removeAnnotation:

Removes the specified annotation object from the map view.

- removeAnnotations:

Removes an array of annotation objects from the map view.