developers

iOS SDK

Open source alternative to MapKit

Welcome to the iOS SDK API documentation. Here you can find details on the classes, protocols, and other parts of the SDK. You might also be interested in the Atom feed, which allows direct embedding of the documentation into Xcode.

Inherits from NSObject
Conforms to RMTileSource
Declared in RMAbstractMercatorTileSource.h

Overview

Abstract class representing a Mercator projection for the display of map tiles. Developers wanting to provide custom network-based tiles should subclass RMAbstractWebMapSource.

Inherits from RMAbstractMercatorTileSource : NSObject
Declared in RMAbstractWebMapSource.h

Overview

Abstract class representing a network-based location for retrieving map tiles for display. Developers can create subclasses in order to provide custom web addresses for tile downloads.

Tasks

Configuring Network Behavior

Providing Tile Images

  • – URLForTile:

    Provide the URL for a given tile.

  • – URLsForTile:

    Provide multiple URLs for a given tile. Each URL is fetched in turn and composited together before placement on the map. URLs are ordered from the bottom layer to the top layer.

Properties

requestTimeoutSeconds

The network timeout for each attempt to download a tile image.

@property (nonatomic, assign) NSTimeInterval requestTimeoutSeconds

Discussion

The network timeout for each attempt to download a tile image.

retryCount

The number of times to retry downloads of a given tile image.

@property (nonatomic, assign) NSUInteger retryCount

Discussion

The number of times to retry downloads of a given tile image.

Instance Methods

URLForTile:

Provide the URL for a given tile.

- (NSURL *)URLForTile:(RMTile)tile

Parameters

tile

A specific map tile.

Return Value

A URL to a tile image to download.

Discussion

Provide the URL for a given tile.

URLsForTile:

Provide multiple URLs for a given tile. Each URL is fetched in turn and composited together before placement on the map. URLs are ordered from the bottom layer to the top layer.

- (NSArray *)URLsForTile:(RMTile)tile

Parameters

tile

A specific map tile.

Return Value

An array of tile URLs to download, listed bottom to top.

Discussion

Provide multiple URLs for a given tile. Each URL is fetched in turn and composited together before placement on the map. URLs are ordered from the bottom layer to the top layer.

Inherits from NSObject
Declared in RMAnnotation.h

Overview

An RMAnnotation defines a container for annotation data to be placed on a map. At a future point in time, depending on map use, a visible layer may be requested and displayed for the annotation. The layer can be set ahead of time using the annotation’s layer property, or, in the recommended approach, can be provided by an RMMapView’s delegate when first needed for display.

Subclasses of RMAnnotation such as RMPointAnnotation, RMPolylineAnnotation, and RMPolygonAnnotation are useful for simple needs such as easily putting points and shapes onto a map view. They manage their own layer and don’t require configuration in the map view delegate in order to be displayed.

Tasks

Configuration Basic Annotation Properties

  •   coordinate

    The annotation’s location on the map.

    property
  •   title

    The annotation’s title.

    property
  •   subtitle

    The annotation’s subtitle.

    property
  •   userInfo

    Storage for arbitrary data.

    property
  •   annotationType

    An arbitrary string representing the type of annotation. Useful for determining which layer to draw for the annotation when requested in the delegate. Cluster annotations, which are automatically created by a map view, will automatically have an annotationType of RMClusterAnnotation.

    property
  •   annotationIcon

    An arbitrary icon image for the annotation. Useful to pass an image at annotation creation time for use in the layer at a later time.

    property
  •   position

    The annotation’s current location on screen. Do not set this directly unless during temporary operations like annotation drags, but rather use the coordinate property to permanently change the annotation’s location on the map.

    property
  •   enabled

    Whether touch events for the annotation’s layer are recognized. Defaults to YES.

    property

Representing an Annotation Visually

  •   layer

    An object representing the annotation’s visual appearance.

    property

Annotation Clustering

  •   clusteringEnabled

    Whether the annotation should be clustered when map view clustering is enabled. Defaults to YES.

    property
  •   isClusterAnnotation

    Whether an annotation is an automatically-managed cluster annotation.

    property
  •   clusteredAnnotations

    If the annotation is a cluster annotation, returns an array containing the annotations in the cluster. Returns nil if the annotation is not a cluster annotation.

    property

Filtering Types of Annotations

  •   isUserLocationAnnotation

    Whether the annotation is related to display of the user’s location. Useful for filtering purposes when providing annotation layers in the delegate.

    property

Initializing Annotations

Querying Annotation Visibility

Properties

annotationIcon

An arbitrary icon image for the annotation. Useful to pass an image at annotation creation time for use in the layer at a later time.

@property (nonatomic, strong) UIImage *annotationIcon

Discussion

An arbitrary icon image for the annotation. Useful to pass an image at annotation creation time for use in the layer at a later time.

Declared In

RMAnnotation.h

annotationType

An arbitrary string representing the type of annotation. Useful for determining which layer to draw for the annotation when requested in the delegate. Cluster annotations, which are automatically created by a map view, will automatically have an annotationType of RMClusterAnnotation.

@property (nonatomic, strong) NSString *annotationType

Discussion

An arbitrary string representing the type of annotation. Useful for determining which layer to draw for the annotation when requested in the delegate. Cluster annotations, which are automatically created by a map view, will automatically have an annotationType of RMClusterAnnotation.

Declared In

RMAnnotation.h

clusteredAnnotations

If the annotation is a cluster annotation, returns an array containing the annotations in the cluster. Returns nil if the annotation is not a cluster annotation.

@property (nonatomic, readonly, assign) NSArray *clusteredAnnotations

Discussion

If the annotation is a cluster annotation, returns an array containing the annotations in the cluster. Returns nil if the annotation is not a cluster annotation.

Declared In

RMAnnotation.h

clusteringEnabled

Whether the annotation should be clustered when map view clustering is enabled. Defaults to YES.

@property (nonatomic, assign) BOOL clusteringEnabled

Discussion

Whether the annotation should be clustered when map view clustering is enabled. Defaults to YES.

Declared In

RMAnnotation.h

coordinate

The annotation’s location on the map.

@property (nonatomic, assign) CLLocationCoordinate2D coordinate

Discussion

The annotation’s location on the map.

Declared In

RMAnnotation.h

enabled

Whether touch events for the annotation’s layer are recognized. Defaults to YES.

@property (nonatomic, assign, getter=isEnabled) BOOL enabled

Discussion

Whether touch events for the annotation’s layer are recognized. Defaults to YES.

Declared In

RMAnnotation.h

isAnnotationOnScreen

Whether the annotation is currently on the screen, regardless if clustered or not.

@property (nonatomic, readonly) BOOL isAnnotationOnScreen

Discussion

Whether the annotation is currently on the screen, regardless if clustered or not.

Declared In

RMAnnotation.h

isAnnotationVisibleOnScreen

Whether the annotation is currently visible on the screen. An annotation is not visible if it is either offscreen or currently in a cluster.

@property (nonatomic, readonly) BOOL isAnnotationVisibleOnScreen

Discussion

Whether the annotation is currently visible on the screen. An annotation is not visible if it is either offscreen or currently in a cluster.

Declared In

RMAnnotation.h

isClusterAnnotation

Whether an annotation is an automatically-managed cluster annotation.

@property (nonatomic, readonly, assign) BOOL isClusterAnnotation

Discussion

Whether an annotation is an automatically-managed cluster annotation.

Declared In

RMAnnotation.h

isUserLocationAnnotation

Whether the annotation is related to display of the user’s location. Useful for filtering purposes when providing annotation layers in the delegate.

@property (nonatomic, readonly) BOOL isUserLocationAnnotation

Discussion

Whether the annotation is related to display of the user’s location. Useful for filtering purposes when providing annotation layers in the delegate.

Declared In

RMAnnotation.h

layer

An object representing the annotation’s visual appearance.

@property (nonatomic, strong) RMMapLayer *layer

Discussion

An object representing the annotation’s visual appearance.

Declared In

RMAnnotation.h

position

The annotation’s current location on screen. Do not set this directly unless during temporary operations like annotation drags, but rather use the coordinate property to permanently change the annotation’s location on the map.

@property (nonatomic, assign) CGPoint position

Discussion

The annotation’s current location on screen. Do not set this directly unless during temporary operations like annotation drags, but rather use the coordinate property to permanently change the annotation’s location on the map.

Declared In

RMAnnotation.h

subtitle

The annotation’s subtitle.

@property (nonatomic, strong) NSString *subtitle

Discussion

The annotation’s subtitle.

Declared In

RMAnnotation.h

title

The annotation’s title.

@property (nonatomic, strong) NSString *title

Discussion

The annotation’s title.

Declared In

RMAnnotation.h

userInfo

Storage for arbitrary data.

@property (nonatomic, strong) id userInfo

Discussion

Storage for arbitrary data.

Declared In

RMAnnotation.h

Class Methods

annotationWithMapView:coordinate:andTitle:

Create and initialize an annotation.

+ (id)annotationWithMapView:(RMMapView *)aMapView coordinate:(CLLocationCoordinate2D)aCoordinate andTitle:(NSString *)aTitle

Parameters

aMapView

The map view on which to place the annotation.

aCoordinate

The location for the annotation.

aTitle

The annotation’s title.

Return Value

An annotation object, or nil if an annotation was unable to be created.

Discussion

Create and initialize an annotation.

Declared In

RMAnnotation.h

Instance Methods

initWithMapView:coordinate:andTitle:

Initialize an annotation.

- (id)initWithMapView:(RMMapView *)aMapView coordinate:(CLLocationCoordinate2D)aCoordinate andTitle:(NSString *)aTitle

Parameters

aMapView

The map view on which to place the annotation.

aCoordinate

The location for the annotation.

aTitle

The annotation’s title.

Return Value

An initialized annotation object, or nil if an annotation was unable to be initialized.

Discussion

Initialize an annotation.

Declared In

RMAnnotation.h

isAnnotationWithinBounds:

Whether the annotation is within a certain screen bounds.

- (BOOL)isAnnotationWithinBounds:(CGRect)bounds

Parameters

bounds

A given screen bounds.

Discussion

Whether the annotation is within a certain screen bounds.

Declared In

RMAnnotation.h
Inherits from NSObject
Declared in RMCacheObject.h

Overview

An RMCacheObject is a representation of a tile cache for use with the RMMemoryCache in-memory cache storage. While RMDatabaseCache uses a disk-based database backing store, RMMemoryCache maintains first-class objects in memory for use later.

Tasks

Managing Cache Objects

Properties

cacheKey

The unique identifier for the cache.

@property (nonatomic, readonly) NSString *cacheKey

Discussion

The unique identifier for the cache.

Declared In

RMCacheObject.h

cachedObject

The object to be cached, typically a UIImage.

@property (nonatomic, readonly) id cachedObject

Discussion

The object to be cached, typically a UIImage.

Declared In

RMCacheObject.h

tile

The tile key for the cache object.

@property (nonatomic, readonly) RMTile tile

Discussion

The tile key for the cache object.

Declared In

RMCacheObject.h

timestamp

The freshness timestamp for the cache object.

@property (nonatomic, readonly) NSDate *timestamp

Discussion

The freshness timestamp for the cache object.

Declared In

RMCacheObject.h

Class Methods

cacheObject:forTile:withCacheKey:

Creates and returns a cache object for a given key and object to store in a given cache.

+ (id)cacheObject:(id)anObject forTile:(RMTile)aTile withCacheKey:(NSString *)aCacheKey

Parameters

anObject

The object to cache, typically a UIImage.

aTile

The tile key for the object.

aCacheKey

The unique identifier for the cache.

Return Value

A newly created cache object.

Discussion

Creates and returns a cache object for a given key and object to store in a given cache.

Declared In

RMCacheObject.h

Instance Methods

initWithObject:forTile:withCacheKey:

Initializes and returns a newly allocated cache object for a given key and object to store in a given cache.

- (id)initWithObject:(id)anObject forTile:(RMTile)tile withCacheKey:(NSString *)aCacheKey

Parameters

anObject

The object to cache, typically a UIImage.

tile

The tile key for the object.

aCacheKey

The unique identifier for the cache.

Return Value

An initialized cache object.

Discussion

Initializes and returns a newly allocated cache object for a given key and object to store in a given cache.

Declared In

RMCacheObject.h

touch

Updates the timestamp on a cache object to indicate freshness. Objects with older timestamps get deleted first when space is needed.

- (void)touch

Discussion

Updates the timestamp on a cache object to indicate freshness. Objects with older timestamps get deleted first when space is needed.

Declared In

RMCacheObject.h
Inherits from RMMapLayer : CAScrollLayer
Declared in RMCircle.h

Overview

An RMCircle is used to represent a perfect circle shape on a map view. An RMCircle changes visible size in response to map zooms in order to consistently represent coverage of the same geographic area.

Tasks

Accessing Drawing Properties

  •   shapeLayer

    The circle’s underlying shape layer.

    property
  •   lineColor

    The circle’s line color. Defaults to black.

    property
  •   fillColor

    The circle’s fill color. Defaults to blue.

    property
  •   fillPatternImage

    The fill pattern image of the circle. If set, the fillColor is set to nil.

    property
  •   radiusInMeters

    The radius of the circle in projected meters. Regardless of map zoom, the circle will change visible size to continously represent this radius on the map.

    property
  •   lineWidthInPixels

    The circle’s line width. Defaults to 10.0.

    property

Creating Circle Objects

Properties

fillColor

The circle’s fill color. Defaults to blue.

@property (nonatomic, strong) UIColor *fillColor

Discussion

The circle’s fill color. Defaults to blue.

Declared In

RMCircle.h

fillPatternImage

The fill pattern image of the circle. If set, the fillColor is set to nil.

@property (nonatomic, strong) UIImage *fillPatternImage

Discussion

The fill pattern image of the circle. If set, the fillColor is set to nil.

Declared In

RMCircle.h

lineColor

The circle’s line color. Defaults to black.

@property (nonatomic, strong) UIColor *lineColor

Discussion

The circle’s line color. Defaults to black.

Declared In

RMCircle.h

lineWidthInPixels

The circle’s line width. Defaults to 10.0.

@property (nonatomic, assign) CGFloat lineWidthInPixels

Discussion

The circle’s line width. Defaults to 10.0.

Declared In

RMCircle.h

radiusInMeters

The radius of the circle in projected meters. Regardless of map zoom, the circle will change visible size to continously represent this radius on the map.

@property (nonatomic, assign) CGFloat radiusInMeters

Discussion

The radius of the circle in projected meters. Regardless of map zoom, the circle will change visible size to continously represent this radius on the map.

Declared In

RMCircle.h

shapeLayer

The circle’s underlying shape layer.

@property (nonatomic, strong) CAShapeLayer *shapeLayer

Discussion

The circle’s underlying shape layer.

Declared In

RMCircle.h

Instance Methods

initWithView:radiusInMeters:

Initializes and returns a newly allocated RMCircle for the specified map view.

- (id)initWithView:(RMMapView *)aMapView radiusInMeters:(CGFloat)newRadiusInMeters

Parameters

aMapView

The map view the shape should be drawn on.

newRadiusInMeters

The radius of the circle object in projected meters. Regardless of map zoom, the circle will change visible size to continously represent this radius on the map.

Discussion

Initializes and returns a newly allocated RMCircle for the specified map view.

Declared In

RMCircle.h
Inherits from NSObject
Declared in RMConfiguration.h

Overview

The RMConfiguration object is a shared instance of the configuration for the library.

Tasks

Accessing the Configuration

Changing and Accessing a Custom User Agent

  •   userAgent

    Access and change the global user agent for HTTP requests using the library.

    property

Properties

userAgent

Access and change the global user agent for HTTP requests using the library.

@property (nonatomic, retain) NSString *userAgent

Discussion

Access and change the global user agent for HTTP requests using the library.

If unset, defaults to MapBox iOS SDK followed by generic hardware model and software version information.

Example: MyMapApp/1.2

Declared In

RMConfiguration.h

Class Methods

configuration

Access the shared instance of the configuration.

+ (RMConfiguration *)configuration

Return Value

The shared configuration instance.

Discussion

Access the shared instance of the configuration.

Declared In

RMConfiguration.h

Instance Methods

cacheConfiguration

Access the disk- and memory-based cache configuration.

- (NSDictionary *)cacheConfiguration

Return Value

A dictionary containing the cache configuration.

Discussion

Access the disk- and memory-based cache configuration.

Declared In

RMConfiguration.h
Inherits from NSObject
Conforms to RMTileCache
Declared in RMDatabaseCache.h

Overview

An RMDatabaseCache object represents disk-based caching of map tile images. This cache is meant for longer-term storage than RMMemoryCache, potentially for long periods of time, allowing completely offline use of map view.

Warning: The database cache is currently based on SQLite, a lightweight, cross-platform, file-based relational database system. The schema is indepenendent of and unrelated to the MBTiles file format or the RMMBTilesSource tile source.

Tasks

Getting the Database Path

  •   databasePath

    The path to the SQLite database on disk that backs the cache.

    property

Initializing Database Caches

Configuring Cache Behavior

Properties

capacity

The capacity, in number of tiles, that the database cache can hold.

@property (nonatomic, readonly, assign) NSUInteger capacity

Discussion

The capacity, in number of tiles, that the database cache can hold.

Declared In

RMDatabaseCache.h

databasePath

The path to the SQLite database on disk that backs the cache.

@property (nonatomic, strong) NSString *databasePath

Discussion

The path to the SQLite database on disk that backs the cache.

Declared In

RMDatabaseCache.h

Instance Methods

initUsingCacheDir:

Initializes and returns a newly allocated database cache object.

- (id)initUsingCacheDir:(BOOL)useCacheDir

Parameters

useCacheDir

If YES, use the temporary cache space for the application, meaning that the cache files can be removed when the system deems it necessary to free up space. If NO, use the application’s document storage space, meaning that the cache will not be automatically removed and will be backed up during device backups. The default value is NO.

Return Value

An initialized cache object or nil if the object couldn’t be created.

Discussion

Initializes and returns a newly allocated database cache object.

Declared In

RMDatabaseCache.h

initWithDatabase:

Initializes and returns a newly allocated database cache object at the given disk path.

- (id)initWithDatabase:(NSString *)path

Parameters

path

The path to use for the database backing.

Return Value

An initialized cache object or nil if the object couldn’t be created.

Discussion

Initializes and returns a newly allocated database cache object at the given disk path.

Declared In

RMDatabaseCache.h

setCapacity:

Set the maximum tile count allowed in the database.

- (void)setCapacity:(NSUInteger)theCapacity

Parameters

theCapacity

The number of tiles to allow to accumulate in the database before purging begins.

Discussion

Set the maximum tile count allowed in the database.

Declared In

RMDatabaseCache.h

setExpiryPeriod:

Set the expiry period for cache purging.

- (void)setExpiryPeriod:(NSTimeInterval)theExpiryPeriod

Parameters

theExpiryPeriod

The amount of time to elapse before a tile should be removed from the cache. If set to zero, tile count-based purging will be used instead of time-based.

Discussion

Set the expiry period for cache purging.

Declared In

RMDatabaseCache.h

setMinimalPurge:

Set the minimum number of tiles to purge when clearing space in the cache.

- (void)setMinimalPurge:(NSUInteger)thePurgeMinimum

Parameters

thePurgeMinimum

The number of tiles to delete at the time the cache is purged.

Discussion

Set the minimum number of tiles to purge when clearing space in the cache.

Declared In

RMDatabaseCache.h

setPurgeStrategy:

Set the cache purge strategy to use for the database.

- (void)setPurgeStrategy:(RMCachePurgeStrategy)theStrategy

Parameters

theStrategy

The cache strategy to use.

Discussion

Set the cache purge strategy to use for the database.

Declared In

RMDatabaseCache.h
Inherits from NSObject
Conforms to RMTileSource
Declared in RMMBTilesSource.h

Overview

An RMMBTilesSource provides for a fast, offline-capable set of map tile images served from a local database. MBTiles is an open standard for map tile image transport.

Tasks

Creating Tile Sources

Querying Tile Source Information

  • – legend

    Any available HTML-formatted map legend data for the tile source, suitable for display in a UIWebView.

  • – centerCoordinate

    A suggested starting center coordinate for the map layer.

  • – centerZoom

    A suggested starting center zoom level for the map layer.

  • – coversFullWorld

    Returns YES if the tile source provides full-world coverage; otherwise, returns NO.

Instance Methods

centerCoordinate

A suggested starting center coordinate for the map layer.

- (CLLocationCoordinate2D)centerCoordinate

Discussion

A suggested starting center coordinate for the map layer.

Declared In

RMMBTilesSource.h

centerZoom

A suggested starting center zoom level for the map layer.

- (float)centerZoom

Discussion

A suggested starting center zoom level for the map layer.

Declared In

RMMBTilesSource.h

coversFullWorld

Returns YES if the tile source provides full-world coverage; otherwise, returns NO.

- (BOOL)coversFullWorld

Discussion

Returns YES if the tile source provides full-world coverage; otherwise, returns NO.

Declared In

RMMBTilesSource.h

initWithTileSetResource:ofType:

Initialize and return a newly allocated MBTiles tile source based on a given bundle resource.

- (id)initWithTileSetResource:(NSString *)name ofType:(NSString *)extension

Parameters

name

The name of the resource file. If name is an empty string or nil, uses the first file encountered of the supplied type.

extension

If extension is an empty string or nil, the extension is assumed not to exist and the file is the first file encountered that exactly matches name.

Discussion

Initialize and return a newly allocated MBTiles tile source based on a given bundle resource.

Declared In

RMMBTilesSource.h

initWithTileSetURL:

Initialize and return a newly allocated MBTiles tile source based on a given local database URL.

- (id)initWithTileSetURL:(NSURL *)tileSetURL

Parameters

tileSetURL

Local file path URL to an MBTiles file.

Return Value

An initialized MBTiles tile source.

Discussion

Initialize and return a newly allocated MBTiles tile source based on a given local database URL.

Declared In

RMMBTilesSource.h

legend

Any available HTML-formatted map legend data for the tile source, suitable for display in a UIWebView.

- (NSString *)legend

Discussion

Any available HTML-formatted map legend data for the tile source, suitable for display in a UIWebView.

Declared In

RMMBTilesSource.h

Overview

An RMMapBoxSource is used to display map tiles from a network-based map hosted on MapBox or the open source TileStream software. Maps are referenced by their MapBox map ID or by a file or URL containing TileJSON.

Tasks

Creating Tile Sources

Querying Tile Source Information

  • – legend

    Any available HTML-formatted map legend data for the tile source, suitable for display in a UIWebView.

  • – centerCoordinate

    A suggested starting center coordinate for the map layer.

  • – centerZoom

    A suggested starting center zoom level for the map layer.

  • – coversFullWorld

    Returns YES if the tile source provides full-world coverage; otherwise, returns NO.

  •   tileJSON

    The TileJSON for the map layer. Useful for saving locally to use in instantiating a tile source while offline.

    property
  •   tileJSONURL

    The TileJSON URL for the map layer. Useful for retrieving TileJSON to save locally to use in instantiating a tile source while offline.

    property
  •   infoDictionary

    The TileJSON data in dictionary format. Useful for retrieving info about the layer without having to parse TileJSON.

    property
  •   imageQuality

    Image quality that is retrieved from the network. Useful for lower-bandwidth environments. The default is to provide full-quality imagery.

    property

Properties

imageQuality

Image quality that is retrieved from the network. Useful for lower-bandwidth environments. The default is to provide full-quality imagery.

@property (nonatomic, assign) RMMapBoxSourceQuality imageQuality

Discussion

Image quality that is retrieved from the network. Useful for lower-bandwidth environments. The default is to provide full-quality imagery.

Note that you may want to clear the tile cache after changing this value in order to provide a consistent experience.

Declared In

RMMapBoxSource.h

infoDictionary

The TileJSON data in dictionary format. Useful for retrieving info about the layer without having to parse TileJSON.

@property (nonatomic, readonly, strong) NSDictionary *infoDictionary

Discussion

The TileJSON data in dictionary format. Useful for retrieving info about the layer without having to parse TileJSON.

Declared In

RMMapBoxSource.h

tileJSON

The TileJSON for the map layer. Useful for saving locally to use in instantiating a tile source while offline.

@property (nonatomic, readonly, strong) NSString *tileJSON

Discussion

The TileJSON for the map layer. Useful for saving locally to use in instantiating a tile source while offline.

Declared In

RMMapBoxSource.h

tileJSONURL

The TileJSON URL for the map layer. Useful for retrieving TileJSON to save locally to use in instantiating a tile source while offline.

@property (nonatomic, readonly, strong) NSURL *tileJSONURL

Discussion

The TileJSON URL for the map layer. Useful for retrieving TileJSON to save locally to use in instantiating a tile source while offline.

Declared In

RMMapBoxSource.h

Instance Methods

centerCoordinate

A suggested starting center coordinate for the map layer.

- (CLLocationCoordinate2D)centerCoordinate

Discussion

A suggested starting center coordinate for the map layer.

Declared In

RMMapBoxSource.h

centerZoom

A suggested starting center zoom level for the map layer.

- (float)centerZoom

Discussion

A suggested starting center zoom level for the map layer.

Declared In

RMMapBoxSource.h

coversFullWorld

Returns YES if the tile source provides full-world coverage; otherwise, returns NO.

- (BOOL)coversFullWorld

Discussion

Returns YES if the tile source provides full-world coverage; otherwise, returns NO.

Declared In

RMMapBoxSource.h

initWithMapID:

Initialize a tile source using the MapBox map ID.

- (id)initWithMapID:(NSString *)mapID

Parameters

mapID

The MapBox map ID string, typically in the format <username>.map-<random characters>.

Return Value

An initialized MapBox tile source.

Discussion

Initialize a tile source using the MapBox map ID.

Declared In

RMMapBoxSource.h

initWithMapID:enablingDataOnMapView:

For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from simplestyle data.

- (id)initWithMapID:(NSString *)mapID enablingDataOnMapView:(RMMapView *)mapView

Parameters

mapID

The MapBox map ID string, typically in the format <username>.map-<random characters>.

mapView

A map view on which to display the annotations.

Return Value

An initialized MapBox tile source.

Discussion

For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from simplestyle data.

Declared In

RMMapBoxSource.h

initWithReferenceURL:

Initialize a tile source with either a remote or local TileJSON structure.

- (id)initWithReferenceURL:(NSURL *)referenceURL

Parameters

referenceURL

A remote or local URL pointing to a TileJSON structure.

Return Value

An initialized MapBox tile source.

Discussion

Initialize a tile source with either a remote or local TileJSON structure.

Declared In

RMMapBoxSource.h

initWithReferenceURL:enablingDataOnMapView:

For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from simplestyle data.

- (id)initWithReferenceURL:(NSURL *)referenceURL enablingDataOnMapView:(RMMapView *)mapView

Parameters

referenceURL

A remote or local URL pointing to a TileJSON structure.

mapView

A map view on which to display the annotations.

Return Value

An initialized MapBox tile source.

Discussion

For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from simplestyle data.

Declared In

RMMapBoxSource.h

initWithTileJSON:

Initialize a tile source with TileJSON.

- (id)initWithTileJSON:(NSString *)tileJSON

Parameters

tileJSON

A string containing TileJSON.

Return Value

An initialized MapBox tile source.

Discussion

Initialize a tile source with TileJSON.

Declared In

RMMapBoxSource.h

initWithTileJSON:enablingDataOnMapView:

For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from simplestyle data.

- (id)initWithTileJSON:(NSString *)tileJSON enablingDataOnMapView:(RMMapView *)mapView

Parameters

tileJSON

A string containing TileJSON.

mapView

A map view on which to display the annotations.

Return Value

An initialized MapBox tile source.

Discussion

For TileJSON 2.1.0+ layers, initialize a tile source and automatically find and add annotations from simplestyle data.

Declared In

RMMapBoxSource.h

legend

Any available HTML-formatted map legend data for the tile source, suitable for display in a UIWebView.

- (NSString *)legend

Discussion

Any available HTML-formatted map legend data for the tile source, suitable for display in a UIWebView.

Declared In

RMMapBoxSource.h
Inherits from CAScrollLayer
Declared in RMMapLayer.h

Overview

RMMapLayer is a generic class for displaying scrollable vector layers on a map view. Generally, a more specialized subclass such as RMMarker will be used for a specific purpose, but RMMapLayer can also be used directly for special purposes.

Tasks

Configuring Map Layer Properties

Properties

annotation

The annotation associated with the layer. This can be useful to inspect the annotation’s userInfo in order to customize the visual representation.

@property (nonatomic, weak) RMAnnotation *annotation

Discussion

The annotation associated with the layer. This can be useful to inspect the annotation’s userInfo in order to customize the visual representation.

Declared In

RMMapLayer.h

calloutOffset

The offset (in pixels) at which to place the callout bubble.

@property (nonatomic, assign) CGPoint calloutOffset

Discussion

The offset (in pixels) at which to place the callout bubble.

This property determines the additional distance by which to move the callout bubble. When this property is set to (0, 0), the anchor point of the callout bubble is placed on the top-center point of the annotation view’s frame. Specifying positive offset values moves the callout bubble down and to the right, while specifying negative values moves it up and to the left.

Declared In

RMMapLayer.h

canShowCallout

A Boolean value indicating whether the annotation layer is able to display extra information in a callout bubble.

@property (nonatomic, assign) BOOL canShowCallout

Discussion

A Boolean value indicating whether the annotation layer is able to display extra information in a callout bubble.

If the value of this property is YES, a standard callout bubble is shown when the user taps the layer. The callout uses the title text from the associated annotation object. If there is no title text, though, the annotation is treated as if its enabled property is set to NO. The callout also displays any custom callout views stored in the leftCalloutAccessoryView and rightCalloutAccessoryView properties.

If the value of this property is NO, the value of the title string is ignored and the annotation remains enabled by default. You can still disable the annotation explicitly using the enabled property.

Note that callouts are not supported on cluster annotation layers. These annotations can be interacted with, but do not remain consistent visually during map pan and zoom events; thus, callout behavior would be inconsistent.

Declared In

RMMapLayer.h

draggingEnabled

When set to YES, the layer can be dragged by the user.

@property (nonatomic, assign) BOOL draggingEnabled

Discussion

When set to YES, the layer can be dragged by the user.

Declared In

RMMapLayer.h

leftCalloutAccessoryView

The view to display on the left side of the standard callout bubble.

@property (nonatomic, strong) UIView *leftCalloutAccessoryView

Discussion

The view to display on the left side of the standard callout bubble.

The default value of this property is nil. The left callout view is typically used to display information about the annotation or to link to custom information provided by your application. The height of your view should be 32 pixels or less.

If the view you specify is also a descendant of the UIControl class, you can use the map view’s delegate to receive notifications when your control is tapped. If it does not descend from UIControl, your view is responsible for handling any touch events within its bounds.

Declared In

RMMapLayer.h

projectedLocation

The current projected location of the layer on the map.

@property (nonatomic, assign) RMProjectedPoint projectedLocation

Discussion

The current projected location of the layer on the map.

Declared In

RMMapLayer.h

rightCalloutAccessoryView

The view to display on the right side of the standard callout bubble.

@property (nonatomic, strong) UIView *rightCalloutAccessoryView

Discussion

The view to display on the right side of the standard callout bubble.

This property is set to nil by default. The right callout view is typically used to link to more detailed information about the annotation. The height of your view should be 32 pixels or less. A common view to specify for this property is UIButton object whose type is set to UIButtonTypeDetailDisclosure.

If the view you specify is also a descendant of the UIControl class, you can use the map view’s delegate to receive notifications when your control is tapped. If it does not descend from UIControl, your view is responsible for handling any touch events within its bounds.

Declared In

RMMapLayer.h

userInfo

Storage for arbitrary data.

@property (nonatomic, strong) id userInfo

Discussion

Storage for arbitrary data.

Declared In

RMMapLayer.h

Instance Methods

setPosition:animated:

Set the screen position of the layer.

- (void)setPosition:(CGPoint)position animated:(BOOL)animated

Parameters

position

The desired screen position.

animated

If set to YES, any position change is animated.

Discussion

Set the screen position of the layer.

Declared In

RMMapLayer.h
Inherits from UIView
Declared in RMMapView.h

Overview

An RMMapView object provides an embeddable map interface, similar to the one provided by Apple’s MapKit. You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and annotate the map with custom information.

Warning: Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use.

Tasks

Accessing the Delegate

Configuring Map Behavior

  •   draggingEnabled

    A Boolean value that determines whether the user may scroll around the map.

    property
  •   bouncingEnabled

    A Boolean value that determines whether the map view bounces past the edge of content and back again and whether it animates the content scaling when the scaling exceeds the maximum or minimum limits.

    property
  •   zoomingInPivotsAroundCenter

    A Boolean value that determines whether double-tap zooms of the map always zoom on the center of the map, or whether they zoom on the center of the double-tap gesture. The default value is NO, which zooms on the gesture.

    property
  •   decelerationMode

    A custom deceleration mode for the map view for drag operations. Set to RMMapDecelerationOff to disable map drag deceleration. The default value is RMMapDecelerationFast.

    property

Supporting Retina Displays

Attributing Map Data

Fine-Tuning the Map Appearance

  •   missingTilesDepth

    Take missing tiles from lower-numbered zoom levels, up to a given number of zoom levels. This can be used in order to increase perceived tile load performance or to allow zooming in beyond levels supported natively by a given tile source. Defaults to 1.

    property
  •   backgroundView

    A custom, static view to use behind the map tiles. The default behavior is to use grid imagery that moves with map panning like MapKit.

    property
  • – setBackgroundImage:

    A custom image to use behind the map tiles. The default behavior is to show the default backgroundView and not a static image.

  •   debugTiles

    A Boolean value indicating whether to draw tile borders and z/x/y numbers on tile images for debugging purposes. Defaults to NO.

    property
  •   showLogoBug

    A Boolean value indicating whether to show a small logo in the corner of the map view. Defaults to YES.

    property

Initializing a Map View

Panning the Map

Zooming the Map

Querying the Map Bounds

Constraining the Map

Capturing Snapshots of the Map View

Annotating the Map

Configuring Annotation Clustering

Managing Tile Sources

Managing Tile Caching Behavior

Converting Map Coordinates

Tracking the User Location

Properties

adjustTilesForRetinaDisplay

A Boolean value that adjusts the display of map tile images for retina-capable screens.

@property (nonatomic, assign) BOOL adjustTilesForRetinaDisplay

Discussion

A Boolean value that adjusts the display of map tile images for retina-capable screens.

If set to YES, the map tiles are drawn at double size, typically 512 pixels square instead of 256 pixels, in order to compensate for smaller features and to make them more legible. If tiles designed for retina devices are used, this value should be set to NO in order to display these tiles at the proper size. The default value is NO.

Declared In

RMMapView.h

annotations

The annotations currently added to the map. Includes user location annotations, if any.

@property (nonatomic, weak, readonly) NSArray *annotations

Discussion

The annotations currently added to the map. Includes user location annotations, if any.

Declared In

RMMapView.h

backgroundView

A custom, static view to use behind the map tiles. The default behavior is to use grid imagery that moves with map panning like MapKit.

@property (nonatomic, strong) UIView *backgroundView

Discussion

A custom, static view to use behind the map tiles. The default behavior is to use grid imagery that moves with map panning like MapKit.

Declared In

RMMapView.h

bouncingEnabled

A Boolean value that determines whether the map view bounces past the edge of content and back again and whether it animates the content scaling when the scaling exceeds the maximum or minimum limits.

@property (nonatomic, assign) BOOL bouncingEnabled

Discussion

A Boolean value that determines whether the map view bounces past the edge of content and back again and whether it animates the content scaling when the scaling exceeds the maximum or minimum limits.

If the value of this property is YES, the map view bounces when it encounters a boundary of the content or when zooming exceeds either the maximum or minimum limits for scaling. Bouncing visually indicates that scrolling or zooming has reached an edge of the content. If the value is NO, scrolling and zooming stop immediately at the content boundary without bouncing.

The default value is NO.

Declared In

RMMapView.h

centerCoordinate

The center coordinate of the map view.

@property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate

Discussion

The center coordinate of the map view.

Declared In

RMMapView.h

centerProjectedPoint

The center point of the map represented as a projected point.

@property (nonatomic, assign) RMProjectedPoint centerProjectedPoint

Discussion

The center point of the map represented as a projected point.

Declared In

RMMapView.h

clusteringEnabled

Whether to enable clustering of map point annotations. Defaults to NO.

@property (nonatomic, assign) BOOL clusteringEnabled

Discussion

Whether to enable clustering of map point annotations. Defaults to NO.

Declared In

RMMapView.h

debugTiles

A Boolean value indicating whether to draw tile borders and z/x/y numbers on tile images for debugging purposes. Defaults to NO.

@property (nonatomic, assign) BOOL debugTiles

Discussion

A Boolean value indicating whether to draw tile borders and z/x/y numbers on tile images for debugging purposes. Defaults to NO.

Declared In

RMMapView.h

decelerationMode

A custom deceleration mode for the map view for drag operations. Set to RMMapDecelerationOff to disable map drag deceleration. The default value is RMMapDecelerationFast.

@property (nonatomic, assign) RMMapDecelerationMode decelerationMode

Discussion

A custom deceleration mode for the map view for drag operations. Set to RMMapDecelerationOff to disable map drag deceleration. The default value is RMMapDecelerationFast.

Declared In

RMMapView.h

delegate

The receiver’s delegate.

@property (nonatomic, weak) IBOutlet id<RMMapViewDelegate> delegate

Discussion

The receiver’s delegate.

A map view sends messages to its delegate regarding the loading of map data and changes in the portion of the map being displayed. The delegate also manages the annotation layers used to highlight points of interest on the map.

The delegate should implement the methods of the RMMapViewDelegate protocol.

Declared In

RMMapView.h

displayHeadingCalibration

Whether the map view should display a heading calibration alert when necessary. The default value is YES.

@property (nonatomic, assign) BOOL displayHeadingCalibration

Discussion

Whether the map view should display a heading calibration alert when necessary. The default value is YES.

Declared In

RMMapView.h

draggingEnabled

A Boolean value that determines whether the user may scroll around the map.

@property (nonatomic, assign) BOOL draggingEnabled

Discussion

A Boolean value that determines whether the user may scroll around the map.

This property controls only user interactions with the map. If you set the value of this property to NO, you may still change the map location programmatically.

The default value of this property is YES.

Declared In

RMMapView.h

hideAttribution

Whether to hide map data attribution for the map view.

@property (nonatomic, assign) BOOL hideAttribution

Discussion

Whether to hide map data attribution for the map view.

If this is set to NO, a small disclosure button will be added to the lower-right of the map view, allowing the user to tap it to display a modal view showing map data attribution info. The modal presentation uses a page curl animation to reveal the attribution info under the map view.

The default value is NO, meaning that attribution info will be shown. Please ensure that the terms & conditions of any map data used in your application are satisfied before setting this value to YES.

Declared In

RMMapView.h

maxZoom

The maximum zoom level of the map, clamped to the range supported by the tile source(s).

@property (nonatomic, assign) float maxZoom

Discussion

The maximum zoom level of the map, clamped to the range supported by the tile source(s).

Declared In

RMMapView.h

minZoom

The minimum zoom level of the map, clamped to the range supported by the tile source(s).

@property (nonatomic, assign) float minZoom

Discussion

The minimum zoom level of the map, clamped to the range supported by the tile source(s).

Declared In

RMMapView.h

missingTilesDepth

Take missing tiles from lower-numbered zoom levels, up to a given number of zoom levels. This can be used in order to increase perceived tile load performance or to allow zooming in beyond levels supported natively by a given tile source. Defaults to 1.

@property (nonatomic, assign) NSUInteger missingTilesDepth

Discussion

Take missing tiles from lower-numbered zoom levels, up to a given number of zoom levels. This can be used in order to increase perceived tile load performance or to allow zooming in beyond levels supported natively by a given tile source. Defaults to 1.

Declared In

RMMapView.h

orderClusterMarkersAboveOthers

Whether to order cluster markers above non-clustered markers. Defaults to NO.

@property (nonatomic, assign) BOOL orderClusterMarkersAboveOthers

Discussion

Whether to order cluster markers above non-clustered markers. Defaults to NO.

Declared In

RMMapView.h

orderMarkersByYPosition

Whether to order markers on the z-axis according to increasing y-position. Defaults to YES.

@property (nonatomic, assign) BOOL orderMarkersByYPosition

Discussion

Whether to order markers on the z-axis according to increasing y-position. Defaults to YES.

Declared In

RMMapView.h

positionClusterMarkersAtTheGravityCenter

Whether to position cluster markers at the weighted center of the points they represent. If YES, position clusters in weighted fashion. If NO, position them on a rectangular grid. Defaults to YES.

@property (nonatomic, assign) BOOL positionClusterMarkersAtTheGravityCenter

Discussion

Whether to position cluster markers at the weighted center of the points they represent. If YES, position clusters in weighted fashion. If NO, position them on a rectangular grid. Defaults to YES.

Declared In

RMMapView.h

selectedAnnotation

The annotation that is currently selected.

@property (nonatomic, strong) RMAnnotation *selectedAnnotation

Discussion

The annotation that is currently selected.

Declared In

RMMapView.h

showLogoBug

A Boolean value indicating whether to show a small logo in the corner of the map view. Defaults to YES.

@property (nonatomic, assign) BOOL showLogoBug

Discussion

A Boolean value indicating whether to show a small logo in the corner of the map view. Defaults to YES.

Declared In

RMMapView.h

showsUserLocation

A Boolean value indicating whether the map may display the user location.

@property (nonatomic, assign) BOOL showsUserLocation

Discussion

A Boolean value indicating whether the map may display the user location.

This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the userLocationVisible property. The default value of this property is NO.

Setting this property to YES causes the map view to use the Core Location framework to find the current location. As long as this property is YES, the map view continues to track the user’s location and update it periodically.

Declared In

RMMapView.h

tileCache

The tile cache for the map view, typically composed of both an in-memory RMMemoryCache and a disk-based RMDatabaseCache.

@property (nonatomic, strong) RMTileCache *tileCache

Discussion

The tile cache for the map view, typically composed of both an in-memory RMMemoryCache and a disk-based RMDatabaseCache.

Declared In

RMMapView.h

tileSource

The first tile source of a map view, ordered from bottom to top.

@property (nonatomic, strong) id<RMTileSource> tileSource

Discussion

The first tile source of a map view, ordered from bottom to top.

Declared In

RMMapView.h

tileSources

All of the tile sources for a map view, ordered bottom to top.

@property (nonatomic, strong) NSArray *tileSources

Discussion

All of the tile sources for a map view, ordered bottom to top.

Declared In

RMMapView.h

userLocation

The annotation object representing the user’s current location. (read-only)

@property (nonatomic, readonly) RMUserLocation *userLocation

Discussion

The annotation object representing the user’s current location. (read-only)

Declared In

RMMapView.h

userLocationVisible

A Boolean value indicating whether the device’s current location is visible in the map view. (read-only)

@property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible

Discussion

A Boolean value indicating whether the device’s current location is visible in the map view. (read-only)

This property uses the horizontal accuracy of the current location to determine whether the user’s location is visible. Thus, this property is YES if the specific coordinate is offscreen but the rectangle surrounding that coordinate (and defined by the horizontal accuracy value) is partially onscreen.

If the user’s location cannot be determined, this property contains the value NO.

Declared In

RMMapView.h

userTrackingMode

The mode used to track the user location.

@property (nonatomic, assign) RMUserTrackingMode userTrackingMode

Discussion

The mode used to track the user location.

Declared In

RMMapView.h

visibleAnnotations

The annotations currently visible on the map. May include annotations currently shown in clusters.

@property (nonatomic, weak, readonly) NSArray *visibleAnnotations

Discussion

The annotations currently visible on the map. May include annotations currently shown in clusters.

Declared In

RMMapView.h

zoom

The current zoom level of the map.

@property (nonatomic, assign) float zoom

Discussion

The current zoom level of the map.

Declared In

RMMapView.h

zoomingInPivotsAroundCenter

A Boolean value that determines whether double-tap zooms of the map always zoom on the center of the map, or whether they zoom on the center of the double-tap gesture. The default value is NO, which zooms on the gesture.

@property (nonatomic, assign) BOOL zoomingInPivotsAroundCenter

Discussion

A Boolean value that determines whether double-tap zooms of the map always zoom on the center of the map, or whether they zoom on the center of the double-tap gesture. The default value is NO, which zooms on the gesture.

Declared In

RMMapView.h

Instance Methods

addAnnotation:

Add an annotation to the map.

- (void)addAnnotation:(RMAnnotation *)annotation

Parameters

annotation

The annotation to add.

Discussion

Add an annotation to the map.

Declared In

RMMapView.h

addAnnotations:

Add one or more annotations to the map.

- (void)addAnnotations:(NSArray *)annotations

Parameters

annotations

An array containing the annotations to add to the map.

Discussion

Add one or more annotations to the map.

Declared In

RMMapView.h

addTileSource:

Add a tile source to a map view above the current tile sources.

- (void)addTileSource:(id<RMTileSource>)tileSource

Parameters

tileSource

The tile source to add.

Discussion

Add a tile source to a map view above the current tile sources.

Declared In

RMMapView.h

addTileSource:atIndex:

Add a tile source to a map view at a given index.

- (void)addTileSource:(id<RMTileSource>)tileSource atIndex:(NSUInteger)index

Parameters

tileSource

The tile source to add.

index

The index at which to add the tile source. A value of zero adds the tile source below all other tile sources.

Discussion

Add a tile source to a map view at a given index.

Declared In

RMMapView.h

coordinateToPixel:

Convert a coordinate to a screen location.

- (CGPoint)coordinateToPixel:(CLLocationCoordinate2D)coordinate

Parameters

coordinate

The coordinate to convert.

Return Value

The equivalent screen location.

Discussion

Convert a coordinate to a screen location.

Declared In

RMMapView.h

coordinateToProjectedPoint:

Convert a coordiante to a projected point.

- (RMProjectedPoint)coordinateToProjectedPoint:(CLLocationCoordinate2D)coordinate

Parameters

coordinate

A coordinate to convert.

Return Value

The equivalent projected point.

Discussion

Convert a coordiante to a projected point.

Declared In

RMMapView.h

deselectAnnotation:animated:

Deselects the specified annotation and hides its callout view.

- (void)deselectAnnotation:(RMAnnotation *)annotation animated:(BOOL)animated

Parameters

annotation

The annotation object to deselect.

animated

If YES, the callout view is animated offscreen.

Discussion

Deselects the specified annotation and hides its callout view.

Declared In

RMMapView.h

initWithFrame:

Initialize a map view with a given frame. A default watermarked MapBox map tile source will be used.

- (id)initWithFrame:(CGRect)frame

Discussion

Initialize a map view with a given frame. A default watermarked MapBox map tile source will be used.

Declared In

RMMapView.h

initWithFrame:andTilesource:

Initialize a map view with a given frame and tile source.

- (id)initWithFrame:(CGRect)frame andTilesource:(id<RMTileSource>)newTilesource

Parameters

frame

The frame with which to initialize the map view.

newTilesource

The tile source to use for the map tiles.

Return Value

An initialized map view, or nil if the map view was unable to be initialized.

Discussion

Initialize a map view with a given frame and tile source.

Declared In

RMMapView.h

initWithFrame:andTilesource:centerCoordinate:zoomLevel:maxZoomLevel:minZoomLevel:backgroundImage:

Designated initializer. Initialize a map view.

- (id)initWithFrame:(CGRect)frame andTilesource:(id<RMTileSource>)newTilesource centerCoordinate:(CLLocationCoordinate2D)initialCenterCoordinate zoomLevel:(float)initialTileSourceZoomLevel maxZoomLevel:(float)initialTileSourceMaxZoomLevel minZoomLevel:(float)initialTileSourceMinZoomLevel backgroundImage:(UIImage *)backgroundImage

Parameters

frame

The map view’s frame.

newTilesource

A tile source to use for the map tiles.

initialCenterCoordinate

The starting map center coordinate.

initialTileSourceZoomLevel

The starting map zoom level, clamped to the zoom levels supported by the tile source(s).

initialTileSourceMaxZoomLevel

The maximum zoom level allowed by the map view, clamped to the zoom levels supported by the tile source(s).

initialTileSourceMinZoomLevel

The minimum zoom level allowed by the map view, clamped to the zoom levels supported by the tile source(s).

backgroundImage

A custom background image to use behind the map instead of the default gridded tile background that moves with the map.

Return Value

An initialized map view, or nil if a map view was unable to be initialized.

Discussion

Designated initializer. Initialize a map view.

Declared In

RMMapView.h

latitudeLongitudeBoundingBox

The smallest bounding box containing the entire map view.

- (RMSphericalTrapezium)latitudeLongitudeBoundingBox

Discussion

The smallest bounding box containing the entire map view.

Declared In

RMMapView.h

latitudeLongitudeBoundingBoxFor:

The smallest bounding box containing a rectangular region of the map view.

- (RMSphericalTrapezium)latitudeLongitudeBoundingBoxFor:(CGRect)rect

Parameters

rect

A rectangular region.

Discussion

The smallest bounding box containing a rectangular region of the map view.

Declared In

RMMapView.h

latitudeLongitudeBoundingBoxForTile:

Return the bounding box for a given map tile.

- (RMSphericalTrapezium)latitudeLongitudeBoundingBoxForTile:(RMTile)aTile

Parameters

aTile

A map tile.

Return Value

The bounding box for the tile in the current projection.

Discussion

Return the bounding box for a given map tile.

Declared In

RMMapView.h

mapPositionForAnnotation:

The screen position for a given annotation.

- (CGPoint)mapPositionForAnnotation:(RMAnnotation *)annotation

Parameters

annotation

The annotation for which to return the current screen position.

Return Value

The screen position of the annotation.

Discussion

The screen position for a given annotation.

Declared In

RMMapView.h

moveBy:

Move the map center by a given delta.

- (void)moveBy:(CGSize)delta

Parameters

delta

A CGSize by which to move the map center.

Discussion

Move the map center by a given delta.

Declared In

RMMapView.h

moveTileSourceAtIndex:toIndex:

Move the tile source at one index to another index.

- (void)moveTileSourceAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex

Parameters

fromIndex

The index of the tile source to move.

toIndex

The destination index for the tile source.

Discussion

Move the tile source at one index to another index.

Declared In

RMMapView.h

pixelToCoordinate:

Convert a screen location to a coordinate.

- (CLLocationCoordinate2D)pixelToCoordinate:(CGPoint)pixelCoordinate

Parameters

pixelCoordinate

A screen location to convert.

Return Value

The equivalent coordinate.

Discussion

Convert a screen location to a coordinate.

Declared In

RMMapView.h

pixelToProjectedPoint:

Convert a screen location to a projected point.

- (RMProjectedPoint)pixelToProjectedPoint:(CGPoint)pixelCoordinate

Parameters

pixelCoordinate

A screen location to convert.

Return Value

The equivalent projected point.

Discussion

Convert a screen location to a projected point.

Declared In

RMMapView.h

projectedPointToCoordinate:

Convert a projected point to a coordinate.

- (CLLocationCoordinate2D)projectedPointToCoordinate:(RMProjectedPoint)projectedPoint

Parameters

projectedPoint

A projected point to convert.

Return Value

The equivalent coordinate.

Discussion

Convert a projected point to a coordinate.

Declared In

RMMapView.h

projectedPointToPixel:

Convert a projected point to a screen location.

- (CGPoint)projectedPointToPixel:(RMProjectedPoint)projectedPoint

Parameters

projectedPoint

The projected point to convert.

Return Value

The equivalent screen location.

Discussion

Convert a projected point to a screen location.

Declared In

RMMapView.h

reloadTileSource:

Reload the tiles for a given tile source.

- (void)reloadTileSource:(id<RMTileSource>)tileSource

Parameters

tileSource

The tile source to reload.

Discussion

Reload the tiles for a given tile source.

Declared In

RMMapView.h

reloadTileSourceAtIndex:

Reload the tiles for a tile source at a given index.

- (void)reloadTileSourceAtIndex:(NSUInteger)index

Parameters

index

The index of the tile source to reload.

Discussion

Reload the tiles for a tile source at a given index.

Declared In

RMMapView.h

removeAllAnnotations

Remove all annotations from the map. This does not remove user location annotations, if any.

- (void)removeAllAnnotations

Discussion

Remove all annotations from the map. This does not remove user location annotations, if any.

Declared In

RMMapView.h

removeAllCachedImages

Clear all tile images from the caching system.

- (void)removeAllCachedImages

Discussion

Clear all tile images from the caching system.

Declared In

RMMapView.h

removeAnnotation:

Remove an annotation from the map.

- (void)removeAnnotation:(RMAnnotation *)annotation

Parameters

annotation

The annotation to remove.

Discussion

Remove an annotation from the map.

Declared In

RMMapView.h

removeAnnotations:

Remove one or more annotations from the map.

- (void)removeAnnotations:(NSArray *)annotations

Parameters

annotations

An array containing the annotations to remove from the map.

Discussion

Remove one or more annotations from the map.

Declared In

RMMapView.h

removeTileSource:

Remove a tile source from the map view.

- (void)removeTileSource:(id<RMTileSource>)tileSource

Parameters

tileSource

The tile source to remove.

Discussion

Remove a tile source from the map view.

Declared In

RMMapView.h

removeTileSourceAtIndex:

Remove the tile source at a given index from the map view.

- (void)removeTileSourceAtIndex:(NSUInteger)index

Parameters

index

The index of the tile source to remove.

Discussion

Remove the tile source at a given index from the map view.

Declared In

RMMapView.h

selectAnnotation:animated:

Selects the specified annotation and displays a callout view for it.

- (void)selectAnnotation:(RMAnnotation *)annotation animated:(BOOL)animated

Parameters

annotation

The annotation object to select.

animated

If YES, the callout view is animated into position.

Discussion

Selects the specified annotation and displays a callout view for it.

If the specified annotation is not onscreen, and therefore does not have an associated annotation layer, this method has no effect.

Declared In

RMMapView.h

setBackgroundImage:

A custom image to use behind the map tiles. The default behavior is to show the default backgroundView and not a static image.

- (void)setBackgroundImage:(UIImage *)backgroundImage

Discussion

A custom image to use behind the map tiles. The default behavior is to show the default backgroundView and not a static image.

Declared In

RMMapView.h

setCenterCoordinate:animated:

Set the map center to a given coordinate.

- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated

Parameters

coordinate

A coordinate to set as the map center.

animated

Whether to animate the change to the map center.

Discussion

Set the map center to a given coordinate.

Declared In

RMMapView.h

setCenterProjectedPoint:animated:

Set the map center to a given projected point.

- (void)setCenterProjectedPoint:(RMProjectedPoint)aPoint animated:(BOOL)animated

Parameters

aPoint

A projected point to set as the map center.

animated

Whether to animate the change to the map center.

Discussion

Set the map center to a given projected point.

Declared In

RMMapView.h

setConstraintsSouthWest:northEast:

Contrain zooming and panning of the map view to a given coordinate boundary.

- (void)setConstraintsSouthWest:(CLLocationCoordinate2D)southWest northEast:(CLLocationCoordinate2D)northEast

Parameters

southWest

The southwest point to constrain to.

northEast

The northeast point to constrain to.

Discussion

Contrain zooming and panning of the map view to a given coordinate boundary.

Declared In

RMMapView.h

setHidden:forTileSource:

Hide or show a tile source.

- (void)setHidden:(BOOL)isHidden forTileSource:(id<RMTileSource>)tileSource

Parameters

isHidden

A Boolean indicating whether to hide the tile source or not.

tileSource

The tile source to hide or show.

Discussion

Hide or show a tile source.

Declared In

RMMapView.h

setHidden:forTileSourceAtIndex:

Hide or show a tile source at a given index.

- (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index

Parameters

isHidden

A Boolean indicating whether to hide the tile source or not.

index

The index of the tile source to hide or show.

Discussion

Hide or show a tile source at a given index.

Declared In

RMMapView.h

setUserTrackingMode:animated:

Set the mode used to track the user location.

- (void)setUserTrackingMode:(RMUserTrackingMode)mode animated:(BOOL)animated

Parameters

mode

The mode used to track the user location.

animated

Whether changes to the map center or rotation should be animated when the mode is changed.

Discussion

Set the mode used to track the user location.

Declared In

RMMapView.h

setZoom:animated:

Set zoom level, optionally with an animation.

- (void)setZoom:(float)newZoom animated:(BOOL)animated

Parameters

newZoom

The desired zoom level.

animated

Whether to animate the map change.

Discussion

Set zoom level, optionally with an animation.

Declared In

RMMapView.h

setZoom:atCoordinate:animated:

Set both zoom level and center coordinate at the same time, optionally with an animation.

- (void)setZoom:(float)newZoom atCoordinate:(CLLocationCoordinate2D)newCenter animated:(BOOL)animated

Parameters

newZoom

The desired zoom level.

newCenter

The desired center coordinate.

animated

Whether to animate the map change.

Discussion

Set both zoom level and center coordinate at the same time, optionally with an animation.

Declared In

RMMapView.h

takeSnapshot

Take a snapshot of the map view.

- (UIImage *)takeSnapshot

Return Value

An image depicting the map view.

Discussion

Take a snapshot of the map view.

By default, the overlay containing any visible annotations is also captured.

Declared In

RMMapView.h

takeSnapshotAndIncludeOverlay:

Take a snapshot of the map view.

- (UIImage *)takeSnapshotAndIncludeOverlay:(BOOL)includeOverlay

Parameters

includeOverlay

Whether to include the overlay containing any visible annotations.

Return Value

An image depicting the map view.

Discussion

Take a snapshot of the map view.

Declared In

RMMapView.h

zoomByFactor:near:animated:

Zoom the map by a given factor near a certain point.

- (void)zoomByFactor:(float)zoomFactor near:(CGPoint)center animated:(BOOL)animated

Parameters

zoomFactor

The factor by which to zoom the map.

center

The point at which to zoom the map.

animated

Whether to animate the zoom.

Discussion

Zoom the map by a given factor near a certain point.

Declared In

RMMapView.h

zoomInToNextNativeZoomAt:animated:

Zoom the map in at the next integral zoom level near a certain point.

- (void)zoomInToNextNativeZoomAt:(CGPoint)pivot animated:(BOOL)animated

Parameters

pivot

The point at which to zoom the map.

animated

Whether to animate the zoom.

Discussion

Zoom the map in at the next integral zoom level near a certain point.

Declared In

RMMapView.h

zoomOutToNextNativeZoomAt:animated:

Zoom the map out at the next integral zoom level near a certain point.

- (void)zoomOutToNextNativeZoomAt:(CGPoint)pivot animated:(BOOL)animated

Parameters

pivot

The point at which to zoom the map.

animated

Whether to animate the zoom.

Discussion

Zoom the map out at the next integral zoom level near a certain point.

Declared In

RMMapView.h

zoomWithLatitudeLongitudeBoundsSouthWest:northEast:animated:

Zoom the map to a given latitude and longitude bounds.

- (void)zoomWithLatitudeLongitudeBoundsSouthWest:(CLLocationCoordinate2D)southWest northEast:(CLLocationCoordinate2D)northEast animated:(BOOL)animated

Parameters

southWest

The southwest point to zoom to.

northEast

The northeast point to zoom to.

animated

Whether to animate the zoom.

Discussion

Zoom the map to a given latitude and longitude bounds.

Declared In

RMMapView.h
Inherits from RMMapLayer : CAScrollLayer
Declared in RMMarker.h

Overview

An RMMarker object is used for simple point annotations on a map view, represented as a single image. RMMarker objects do not change in size when the map view zooms in or out, but instead stay the same size to consistently represent a point on the map view.

Tasks

Setting Label Properties

  •   label

    A custom label for the marker. The label is shown when first set.

    property
  •   textForegroundColor

    The marker object’s label text foreground color. Defaults to black.

    property
  •   textBackgroundColor

    The marker object’s label text background color. Defaults to clear.

    property
  • + defaultFont

    The font used for labels when another font is not explicitly requested. The default is the system font with size 15.

Creating Markers With Images

Creating Markers Using MapBox Images

Altering Labels

Showing and Hiding Labels

Altering Images

Properties

label

A custom label for the marker. The label is shown when first set.

@property (nonatomic, strong) UIView *label

Discussion

A custom label for the marker. The label is shown when first set.

Declared In

RMMarker.h

textBackgroundColor

The marker object’s label text background color. Defaults to clear.

@property (nonatomic, strong) UIColor *textBackgroundColor

Discussion

The marker object’s label text background color. Defaults to clear.

Declared In

RMMarker.h

textForegroundColor

The marker object’s label text foreground color. Defaults to black.

@property (nonatomic, strong) UIColor *textForegroundColor

Discussion

The marker object’s label text foreground color. Defaults to black.

Declared In

RMMarker.h

Class Methods

clearCachedMapBoxMarkers

Clears the local cache of Mapbox Marker images. Images are cached locally upon first use so that if the application goes offline, markers can still be used.

+ (void)clearCachedMapBoxMarkers

Discussion

Clears the local cache of Mapbox Marker images. Images are cached locally upon first use so that if the application goes offline, markers can still be used.

Declared In

RMMarker.h

defaultFont

The font used for labels when another font is not explicitly requested. The default is the system font with size 15.

+ (UIFont *)defaultFont

Discussion

The font used for labels when another font is not explicitly requested. The default is the system font with size 15.

Declared In

RMMarker.h

Instance Methods

changeLabelUsingText:

Changes the label to a UILabel with the supplied text and default marker font and using the existing text foreground and background colors.

- (void)changeLabelUsingText:(NSString *)text

Parameters

text

The text for the label.

Discussion

Changes the label to a UILabel with the supplied text and default marker font and using the existing text foreground and background colors.

Declared In

RMMarker.h

changeLabelUsingText:font:foregroundColor:backgroundColor:

Changes the label to a UILabel with the supplied text and font and using the given text foreground and background colors.

- (void)changeLabelUsingText:(NSString *)text font:(UIFont *)font foregroundColor:(UIColor *)textColor backgroundColor:(UIColor *)backgroundColor

Parameters

text

The text for the label.

font

A font to use for the label text.

textColor

The color for the label text.

backgroundColor

The color for the label background.

Discussion

Changes the label to a UILabel with the supplied text and font and using the given text foreground and background colors.

Declared In

RMMarker.h

hideLabel

Hide the marker’s label, if any.

- (void)hideLabel

Discussion

Hide the marker’s label, if any.

Declared In

RMMarker.h

initWithMapBoxMarkerImage

Initializes and returns a newly allocated marker object using a red, medium-sized star pin image.

- (id)initWithMapBoxMarkerImage

Discussion

Initializes and returns a newly allocated marker object using a red, medium-sized star pin image.

Declared In

RMMarker.h

initWithMapBoxMarkerImage:

Initializes and returns a newly allocated marker object using a red, medium-sized pin image and a given symbol name, e.g., bus.

- (id)initWithMapBoxMarkerImage:(NSString *)symbolName

Parameters

symbolName

A symbol name from the Maki icon set.

Return Value

An initialized RMMarker layer.

Discussion

Initializes and returns a newly allocated marker object using a red, medium-sized pin image and a given symbol name, e.g., bus.

Declared In

RMMarker.h

initWithMapBoxMarkerImage:tintColor:

Initializes and returns a newly allocated marker object using a medium-sized pin image, a given symbol name, e.g., bus, and a given color.

- (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColor:(UIColor *)color

Parameters

symbolName

A symbol name from the Maki icon set.

color

A color for the marker.

Return Value

An initialized RMMarker layer.

Discussion

Initializes and returns a newly allocated marker object using a medium-sized pin image, a given symbol name, e.g., bus, and a given color.

Declared In

RMMarker.h

initWithMapBoxMarkerImage:tintColor:size:

Initializes and returns a newly allocated marker object using a pin image, a given symbol name, e.g., bus, a given color, and a given size.

- (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColor:(UIColor *)color size:(RMMarkerMapBoxImageSize)size

Parameters

symbolName

A symbol name from the Maki icon set.

color

A color for the marker.

size

A size for the marker.

Return Value

An initialized RMMarker layer.

Discussion

Initializes and returns a newly allocated marker object using a pin image, a given symbol name, e.g., bus, a given color, and a given size.

Declared In

RMMarker.h

initWithMapBoxMarkerImage:tintColorHex:

Initializes and returns a newly allocated marker object using a medium-sized pin image, a given symbol name, e.g., bus, and a given HTML hex color, e.g., ff0000.

- (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColorHex:(NSString *)colorHex

Parameters

symbolName

A symbol name from the Maki icon set.

colorHex

A color for the marker specified as an HTML hex code.

Return Value

An initialized RMMarker layer.

Discussion

Initializes and returns a newly allocated marker object using a medium-sized pin image, a given symbol name, e.g., bus, and a given HTML hex color, e.g., ff0000.

Declared In

RMMarker.h

initWithMapBoxMarkerImage:tintColorHex:sizeString:

Initializes and returns a newly allocated marker object using a pin image, a given symbol name, e.g., bus, a given HTML hex color, e.g., ff0000, and a given size, e.g., large.

- (id)initWithMapBoxMarkerImage:(NSString *)symbolName tintColorHex:(NSString *)colorHex sizeString:(NSString *)sizeString

Parameters

symbolName

A symbol name from the Maki icon set.

colorHex

A color for the marker specified as an HTML hex code.

sizeString

A size such as small, medium, or large.

Return Value

An initialized RMMarker layer.

Discussion

Initializes and returns a newly allocated marker object using a pin image, a given symbol name, e.g., bus, a given HTML hex color, e.g., ff0000, and a given size, e.g., large.

Declared In

RMMarker.h

initWithUIImage:

Initializes and returns a newly allocated marker object using the specified image.

- (id)initWithUIImage:(UIImage *)image

Parameters

image

An image to use for the marker.

Discussion

Initializes and returns a newly allocated marker object using the specified image.

Declared In

RMMarker.h

initWithUIImage:anchorPoint:

Initializes and returns a newly allocated marker object using the specified image and anchor point.

- (id)initWithUIImage:(UIImage *)image anchorPoint:(CGPoint)anchorPoint

Parameters

image

An image to use for the marker.

anchorPoint

A point representing a range from 0 to 1 in each of the height and width coordinate space, normalized to the size of the image, at which to place the image.

Return Value

An initialized marker object.

Discussion

Initializes and returns a newly allocated marker object using the specified image and anchor point.

Declared In

RMMarker.h

replaceUIImage:

Replace the image for a marker.

- (void)replaceUIImage:(UIImage *)image

Parameters

image

An image to use for the marker.

Discussion

Replace the image for a marker.

Declared In

RMMarker.h

replaceUIImage:anchorPoint:

Replace the image for a marker using a custom anchor point.

- (void)replaceUIImage:(UIImage *)image anchorPoint:(CGPoint)anchorPoint

Parameters

image

An image to use for the marker.

anchorPoint

A point representing a range from 0 to 1 in each of the height and width coordinate space, normalized to the size of the image, at which to place the image.

Discussion

Replace the image for a marker using a custom anchor point.

Declared In

RMMarker.h

showLabel

Show the marker’s label, if any.

- (void)showLabel

Discussion

Show the marker’s label, if any.

Declared In

RMMarker.h

toggleLabel

Toggle the display of the marker’s label, if any. If hidden, show and if shown, hide.

- (void)toggleLabel

Discussion

Toggle the display of the marker’s label, if any. If hidden, show and if shown, hide.

Declared In

RMMarker.h
Inherits from NSObject
Conforms to RMTileCache
Declared in RMMemoryCache.h

Overview

An RMMemoryCache object represents memory-based caching of map tile images. Since memory is constrained in the iOS environment, this cache is relatively small, but useful for increasing performance.

Tasks

Initializing Memory Caches

Cache Capacity

  •   capacity

    The capacity, in number of tiles, that the memory cache can hold.

    property

Making Space in the Cache

  • – makeSpaceInCache

    Remove the least-recently used image from the cache if the cache is at or over capacity. This removes a single image from the cache.

Properties

capacity

The capacity, in number of tiles, that the memory cache can hold.

@property (nonatomic, readonly, assign) NSUInteger capacity

Discussion

The capacity, in number of tiles, that the memory cache can hold.

Declared In

RMMemoryCache.h

Instance Methods

initWithCapacity:

Initializes and returns a newly allocated memory cache object with the specified tile count capacity.

- (id)initWithCapacity:(NSUInteger)aCapacity

Parameters

aCapacity

The maximum number of tiles to be held in the cache.

Return Value

An initialized memory cache object or nil if the object couldn’t be created.

Discussion

Initializes and returns a newly allocated memory cache object with the specified tile count capacity.

Declared In

RMMemoryCache.h

makeSpaceInCache

Remove the least-recently used image from the cache if the cache is at or over capacity. This removes a single image from the cache.

- (void)makeSpaceInCache

Discussion

Remove the least-recently used image from the cache if the cache is at or over capacity. This removes a single image from the cache.

Declared In

RMMemoryCache.h
Inherits from RMAnnotation : NSObject
Declared in RMPointAnnotation.h

Overview

An RMPointAnnotation is used to represent a single point on a map. The annotation will automatically have a layer created when needed that displays an RMMarker with a default point icon.

If you wish to customize the appearance, you should instead create an RMAnnotation and configure its layer directly. Providing a layer manually for instances of RMPointAnnotation will not have any effect.

Inherits from RMShapeAnnotation : RMAnnotation : NSObject
Declared in RMPolygonAnnotation.h

Overview

An RMPolygonAnnotation is a concrete subclass of RMShapeAnnotation that is used to represent a shape consisting of one or more points that define a closed polygon. The points are connected end-to-end in the order they are provided. The first and last points are connected to each other to create the closed shape. The annotation will automatically have a layer created when needed that displays an RMShape.

When creating a polygon, you can mask out portions of the polygon by specifying one or more interior polygons. Areas that are masked by an interior polygon are not considered part of the polygon’s occupied area.

If you wish to customize the appearance, you should instead create an RMAnnotation and configure its layer directly. Providing a layer manually for instances of RMPolygonAnnotation will not have any effect.

Tasks

Properties

interiorPolygons

The array of polygons nested inside the receiver. (read-only)

@property (nonatomic, readonly, strong) NSArray *interiorPolygons

Discussion

The array of polygons nested inside the receiver. (read-only)

When a polygon is rendered on screen, the area occupied by any interior polygons is masked out and not considered part of the polygon.

Declared In

RMPolygonAnnotation.h

Instance Methods

initWithMapView:points:interiorPolygons:

Initialize a polygon annotation.

- (id)initWithMapView:(RMMapView *)aMapView points:(NSArray *)points interiorPolygons:(NSArray *)interiorPolygons

Parameters

aMapView

The map view on which to place the annotation.

points

An array of CLLocation points defining the shape. The data in this array is copied to the new object.

interiorPolygons

An array of RMPolygonAnnotation objects that define one or more cutout regions for the receiver’s polygon.

Return Value

An initialized shape annotation object, or nil if an annotation was unable to be initialized.

Discussion

Initialize a polygon annotation.

Declared In

RMPolygonAnnotation.h
Inherits from RMShapeAnnotation : RMAnnotation : NSObject
Declared in RMPolylineAnnotation.h

Overview

An RMPolylineAnnotation is a concrete subclass of RMShapeAnnotation that is used to represent a shape consisting of one or more points that define connecting line segments. The points are connected end-to-end in the order they are provided. The first and last points are not connected to each other. The annotation will automatically have a layer created when needed that displays an RMShape.

If you wish to customize the appearance, you should instead create an RMAnnotation and configure its layer directly. Providing a layer manually for instances of RMPolylineAnnotation will not have any effect.

Inherits from RMMapLayer : CAScrollLayer
Declared in RMShape.h

Overview

An RMShape object is used to represent a line, polygon, or other shape composed of two or more points connected by lines. An RMShape object changes visible size in response to map zooms in order to consistently represent coverage of the same geographic area.

Tasks

Creating Shape Objects

  • – initWithView:

    Initializes and returns a newly allocated shape object for the specified map view.

Accessing the Drawing Properties

Drawing Shapes

Properties

fillColor

The fill color of the shape. Defaults to clear.

@property (nonatomic, strong) UIColor *fillColor

Discussion

The fill color of the shape. Defaults to clear.

Declared In

RMShape.h

fillPatternImage

The fill pattern image of the shape. If set, the fillColor is set to nil.

@property (nonatomic, strong) UIImage *fillPatternImage

Discussion

The fill pattern image of the shape. If set, the fillColor is set to nil.

Declared In

RMShape.h

lineColor

The line color of the shape. Defaults to black.

@property (nonatomic, strong) UIColor *lineColor

Discussion

The line color of the shape. Defaults to black.

Declared In

RMShape.h

lineWidth

The line width of the shape. Defaults to 2.0.

@property (nonatomic, assign) float lineWidth

Discussion

The line width of the shape. Defaults to 2.0.

Declared In

RMShape.h

pathBoundingBox

The bounding box of the shape in the current viewport.

@property (nonatomic, readonly) CGRect pathBoundingBox

Discussion

The bounding box of the shape in the current viewport.

Declared In

RMShape.h

Instance Methods

addCurveToCoordinate:controlCoordinate1:controlCoordinate2:

Draw a curve from the current pen location to a coordinate.

- (void)addCurveToCoordinate:(CLLocationCoordinate2D)coordinate controlCoordinate1:(CLLocationCoordinate2D)controlCoordinate1 controlCoordinate2:(CLLocationCoordinate2D)controlCoordinate2

Parameters

coordinate

The coordinate to draw to.

controlCoordinate1

The first control coordinate.

controlCoordinate2

The second control coordinate.

Discussion

Draw a curve from the current pen location to a coordinate.

Declared In

RMShape.h

addCurveToProjectedPoint:controlProjectedPoint1:controlProjectedPoint2:

Draw a curve from the current pen location to a projected point.

- (void)addCurveToProjectedPoint:(RMProjectedPoint)projectedPoint controlProjectedPoint1:(RMProjectedPoint)controlProjectedPoint1 controlProjectedPoint2:(RMProjectedPoint)controlProjectedPoint2

Parameters

projectedPoint

The projected point to draw to.

controlProjectedPoint1

The first control projected point.

controlProjectedPoint2

The second control projected point.

Discussion

Draw a curve from the current pen location to a projected point.

Declared In

RMShape.h

addLineToCoordinate:

Draw a line from the current pen location to a coordinate.

- (void)addLineToCoordinate:(CLLocationCoordinate2D)coordinate

Parameters

coordinate

The coordinate to draw to.

Discussion

Draw a line from the current pen location to a coordinate.

Declared In

RMShape.h

addLineToProjectedPoint:

Draw a line from the current pen location to a projected point.

- (void)addLineToProjectedPoint:(RMProjectedPoint)projectedPoint

Parameters

projectedPoint

The projected point to draw to.

Discussion

Draw a line from the current pen location to a projected point.

Declared In

RMShape.h

addLineToScreenPoint:

Draw a line from the current pen location to a screen point.

- (void)addLineToScreenPoint:(CGPoint)point

Parameters

point

The screen point to draw to.

Discussion

Draw a line from the current pen location to a screen point.

Declared In

RMShape.h

addQuadCurveToCoordinate:controlCoordinate:

Draw a quad curve from the current pen location to a coordinate.

- (void)addQuadCurveToCoordinate:(CLLocationCoordinate2D)coordinate controlCoordinate:(CLLocationCoordinate2D)controlCoordinate

Parameters

coordinate

The coordinate to draw to.

controlCoordinate

The control coordinate.

Discussion

Draw a quad curve from the current pen location to a coordinate.

Declared In

RMShape.h

addQuadCurveToProjectedPoint:controlProjectedPoint:

Draw a quad curve from the current pen location to a projected point.

- (void)addQuadCurveToProjectedPoint:(RMProjectedPoint)projectedPoint controlProjectedPoint:(RMProjectedPoint)controlProjectedPoint

Parameters

projectedPoint

The projected point to draw to.

controlProjectedPoint

The control projected point.

Discussion

Draw a quad curve from the current pen location to a projected point.

Declared In

RMShape.h

closePath

Closes the path, connecting the last point to the first. After this action, no further points can be added to the path.

- (void)closePath

Discussion

Closes the path, connecting the last point to the first. After this action, no further points can be added to the path.

There is no requirement that a path be closed.

Declared In

RMShape.h

initWithView:

Initializes and returns a newly allocated shape object for the specified map view.

- (id)initWithView:(RMMapView *)aMapView

Parameters

aMapView

The map view the shape should be drawn on.

Discussion

Initializes and returns a newly allocated shape object for the specified map view.

Declared In

RMShape.h

moveToCoordinate:

Move the drawing pen to a coordinate.

- (void)moveToCoordinate:(CLLocationCoordinate2D)coordinate

Parameters

coordinate

The coordinate to move to.

Discussion

Move the drawing pen to a coordinate.

Declared In

RMShape.h

moveToProjectedPoint:

Move the drawing pen to a projected point.

- (void)moveToProjectedPoint:(RMProjectedPoint)projectedPoint

Parameters

projectedPoint

The projected point to move to.

Discussion

Move the drawing pen to a projected point.

Declared In

RMShape.h

moveToScreenPoint:

Move the drawing pen to a screen point.

- (void)moveToScreenPoint:(CGPoint)point

Parameters

point

The screen point to move to.

Discussion

Move the drawing pen to a screen point.

Declared In

RMShape.h

performBatchOperations:

Alter the path without rerecalculating the geometry. Recommended for many operations in order to increase performance.

- (void)performBatchOperations:(void ( ^ ) ( RMShape *aShape ))block

Parameters

block

A block containing the operations to perform.

Discussion

Alter the path without rerecalculating the geometry. Recommended for many operations in order to increase performance.

Declared In

RMShape.h
Inherits from RMAnnotation : NSObject
Declared in RMShapeAnnotation.h

Overview

An RMShapeAnnotation is an abstract subclass of RMAnnotation that is used to represent a shape consisting of one or more points. You should not create instances of this class directly. Instead, you should create instances of the RMPolylineAnnotation or RMPolygonAnnotation classes. However, you can use the properties of this class to access information about the specific points associated with the line or polygon.

Providing a layer manually for instances of RMShapeAnnotation subclasses will not have any effect.

Tasks

Properties

points

The array of points associated with the shape. (read-only)

@property (nonatomic, readonly, strong) NSArray *points

Discussion

The array of points associated with the shape. (read-only)

Declared In

RMShapeAnnotation.h

Instance Methods

initWithMapView:points:

Initialize a shape annotation.

- (id)initWithMapView:(RMMapView *)aMapView points:(NSArray *)points

Parameters

aMapView

The map view on which to place the annotation.

points

An array of CLLocation points defining the shape. The data in this array is copied to the new object.

Return Value

An initialized shape annotation object, or nil if an annotation was unable to be initialized.

Discussion

Initialize a shape annotation.

Declared In

RMShapeAnnotation.h
Inherits from RMMapView : UIView
Declared in RMStaticMapView.h

Overview

An RMStaticMapView object provides an embeddable, static map image view. You use this class to display map information in your application that does not need to change or provide user interaction. You can center the map on a given coordinate and zoom level, specify the size of the area you want to display, and optionally provide a completion handler that can be performed upon map load. The map can also automatically have markers added to it if they were provided as simplestyle data when the map was created.

Warning: Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use. You are also responsible for displaying attribution details for the data elsewhere in your application, if applicable.

Tasks

Initializing a Static Map View

Instance Methods

initWithFrame:mapID:

Initialize a static map view with a given frame and mapID.

- (id)initWithFrame:(CGRect)frame mapID:(NSString *)mapID

Parameters

frame

The frame with which to initialize the map view.

mapID

The MapBox map ID string, typically in the format <username>.map-<mapname>.

Return Value

An initialized map view, or nil if the map view was unable to be initialized.

Discussion

Initialize a static map view with a given frame and mapID.

The map ID is expected to provide initial center coordinate and zoom level information, and may optionally also include simplestyle marker data, which will automatically be added to the map view.

Declared In

RMStaticMapView.h

initWithFrame:mapID:centerCoordinate:zoomLevel:

Initialize a static map view with a given frame, mapID, center coordinate, and zoom level.

- (id)initWithFrame:(CGRect)frame mapID:(NSString *)mapID centerCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(CGFloat)zoomLevel

Parameters

frame

The frame with which to initialize the map view.

mapID

The MapBox map ID string, typically in the format <username>.map-<mapname>.

centerCoordinate

The map center coordinate.

zoomLevel

The map zoom level.

Return Value

An initialized map view, or nil if the map view was unable to be initialized.

Discussion

Initialize a static map view with a given frame, mapID, center coordinate, and zoom level.

The map ID may optionally also include simplestyle marker data, which will automatically be added to the map view.

Declared In

RMStaticMapView.h

initWithFrame:mapID:centerCoordinate:zoomLevel:completionHandler:

Designated initializer. Initialize a static map view with a given frame, mapID, center coordinate, and zoom level, performing a block upon completion of the map load.

- (id)initWithFrame:(CGRect)frame mapID:(NSString *)mapID centerCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(CGFloat)zoomLevel completionHandler:(void ( ^ ) ( UIImage *))handler

Parameters

frame

The frame with which to initialize the map view.

mapID

The MapBox map ID string, typically in the format <username>.map-<mapname>.

centerCoordinate

The map center coordinate.

zoomLevel

The map zoom level.

handler

A block to be performed upon map load completion. An image of the map, including markers, is passed as an argument to the block in the event that you wish to use it elsewhere. The handler will be called on the main dispatch queue.

Return Value

An initialized map view, or nil if the map view was unable to be initialized.

Discussion

Designated initializer. Initialize a static map view with a given frame, mapID, center coordinate, and zoom level, performing a block upon completion of the map load.

The map ID may optionally also include simplestyle marker data, which will automatically be added to the map view. The block will be performed upon completion of the load of both the map and of any simplestyle markers included with the map ID.

Declared In

RMStaticMapView.h

initWithFrame:mapID:completionHandler:

Initialize a static map view with a given frame and mapID, performing a block upon completion of the map load.

- (id)initWithFrame:(CGRect)frame mapID:(NSString *)mapID completionHandler:(void ( ^ ) ( UIImage *))handler

Parameters

frame

The frame with which to initialize the map view.

mapID

The MapBox map ID string, typically in the format <username>.map-<mapname>.

handler

A block to be performed upon map and marker load completion. An image of the map, including markers, is passed as an argument to the block in the event that you wish to use it elsewhere. The handler will be called on the main dispatch queue.

Return Value

An initialized map view, or nil if the map view was unable to be initialized.

Discussion

Initialize a static map view with a given frame and mapID, performing a block upon completion of the map load.

The map ID is expected to provide initial center coordinate and zoom level information, and may optionally also include simplestyle marker data, which will automatically be added to the map view. The block will be performed upon completion of the load of both the map and of any simplestyle markers included with the map ID.

Declared In

RMStaticMapView.h
Inherits from NSObject
Conforms to RMTileCache
Declared in RMTileCache.h

Overview

An RMTileCache object manages memory-based and disk-based caches for map tiles that have been retrieved from the network.

An RMMapView has one RMTileCache across all tile sources, which is further divided according to each tile source’s uniqueTilecacheKey property in order to keep tiles separate in the cache.

An RMTileCache is a key component of offline map use. All tile requests pass through the tile cache and are served from cache if available, avoiding network operation. If tiles exist in cache already, a tile source that is instantiated when offline will still be able to serve tile imagery to the map renderer for areas that have been previously cached. This can occur either from normal map use, since all tiles are cached after being retrieved, or from proactive caching ahead of time using the beginBackgroundCacheForTileSource:southWest:northEast:minZoom:maxZoom: method.

Tasks

Initializing a Cache Manager

Identifying Cache Objects

  • + tileHash:

    Return an identifying hash number for the specified tile.

Adding Caches to the Cache Manager

  • – addCache:

    Adds a given cache to the cache management system.

  •   tileCaches

    The list of caches managed by a cache manager. This could include memory-based, disk-based, or other types of caches.

    property

Background Downloading

Properties

backgroundCacheDelegate

A delegate to notify of background tile cache download operations.

@property (nonatomic, weak) id<RMTileCacheBackgroundDelegate> backgroundCacheDelegate

Discussion

A delegate to notify of background tile cache download operations.

Declared In

RMTileCache.h

isBackgroundCaching

Whether or not the tile cache is currently background caching.

@property (nonatomic, readonly, assign) BOOL isBackgroundCaching

Discussion

Whether or not the tile cache is currently background caching.

Declared In

RMTileCache.h

tileCaches

The list of caches managed by a cache manager. This could include memory-based, disk-based, or other types of caches.

@property (nonatomic, readonly, strong) NSArray *tileCaches

Discussion

The list of caches managed by a cache manager. This could include memory-based, disk-based, or other types of caches.

Declared In

RMTileCache.h

Class Methods

tileHash:

Return an identifying hash number for the specified tile.

+ (NSNumber *)tileHash:(RMTile)tile

Parameters

tile

A tile image to hash.

Return Value

A unique number for the specified tile.

Discussion

Return an identifying hash number for the specified tile.

Declared In

RMTileCache.h

Instance Methods

addCache:

Adds a given cache to the cache management system.

- (void)addCache:(id<RMTileCache>)cache

Parameters

cache

A memory-based or disk-based cache.

Discussion

Adds a given cache to the cache management system.

Declared In

RMTileCache.h

beginBackgroundCacheForTileSource:southWest:northEast:minZoom:maxZoom:

Tells the tile cache to begin background caching. Progress during the caching operation can be observed by implementing the RMTileCacheBackgroundDelegate protocol.

- (void)beginBackgroundCacheForTileSource:(id<RMTileSource>)tileSource southWest:(CLLocationCoordinate2D)southWest northEast:(CLLocationCoordinate2D)northEast minZoom:(float)minZoom maxZoom:(float)maxZoom

Parameters

tileSource

The tile source from which to retrieve tiles.

southWest

The southwest corner of the geographic area to cache.

northEast

The northeast corner of the geographic area to cache.

minZoom

The minimum zoom level to cache.

maxZoom

The maximum zoom level to cache.

Discussion

Tells the tile cache to begin background caching. Progress during the caching operation can be observed by implementing the RMTileCacheBackgroundDelegate protocol.

Declared In

RMTileCache.h

cancelBackgroundCache

Cancel any background caching.

- (void)cancelBackgroundCache

Discussion

Cancel any background caching.

This method returns immediately so as to not block the calling thread. If you wish to be notified of the actual cancellation completion, implement the tileCacheDidCancelBackgroundCache: delegate method.

Declared In

RMTileCache.h

initWithExpiryPeriod:

Initializes and returns a newly allocated cache object with specified expiry period.

- (id)initWithExpiryPeriod:(NSTimeInterval)period

Parameters

period

A period of time after which tiles should be expunged from the cache.

Return Value

An initialized cache object or nil if the object couldn’t be created.

Discussion

Initializes and returns a newly allocated cache object with specified expiry period.

If the init method is used to initialize a cache instead, a period of 0 is used. In that case, time-based expiration of tiles is not performed, but rather the cached tile count is used instead.

Declared In

RMTileCache.h
Inherits from RMGenericMapSource
Declared in RMTileMillSource.h

Overview

An RMTileMillSource is used to display map tiles from a live, running instance of TileMill. All instances of TileMill automatically include an HTTP server, allowing network access outside of the application. This tile source allows for an easier development cycle between map editing and testing in an iOS application.

Tasks

Creating Tile Sources

  • – initWithMapName:tileCacheKey:minZoom:maxZoom:

    Initialize and return a newly allocated TileMill tile source based on a given map name. This assumes that TileMill is running on the local development computer (e.g., localhost), which will not work from an iOS device but will work in the iOS Simulator.

  • – initWithHost:mapName:tileCacheKey:minZoom:maxZoom:

    Initialize and return a newly allocated TileMill tile source based on a given host and map name. This is ideal for testing on an actual iOS device if the network name or address of the computer running TileMill is passed as the host parameter.

Instance Methods

initWithHost:mapName:tileCacheKey:minZoom:maxZoom:

Initialize and return a newly allocated TileMill tile source based on a given host and map name. This is ideal for testing on an actual iOS device if the network name or address of the computer running TileMill is passed as the host parameter.

- (id)initWithHost:(NSString *)host mapName:(NSString *)mapName tileCacheKey:(NSString *)tileCacheKey minZoom:(float)minZoom maxZoom:(float)maxZoom

Parameters

host

The hostname or IP address of the computer running TileMill.

mapName

The name of the map in TileMill, substituting dashes for spaces.

tileCacheKey

A unique cache string to use for this tile source’s tiles in the tile cache.

minZoom

The minimum zoom level supported by the map.

maxZoom

The maximum zoom level supported by the map.

Return Value

An initialized TileMill tile source.

Discussion

Initialize and return a newly allocated TileMill tile source based on a given host and map name. This is ideal for testing on an actual iOS device if the network name or address of the computer running TileMill is passed as the host parameter.

Declared In

RMTileMillSource.h

initWithMapName:tileCacheKey:minZoom:maxZoom:

Initialize and return a newly allocated TileMill tile source based on a given map name. This assumes that TileMill is running on the local development computer (e.g., localhost), which will not work from an iOS device but will work in the iOS Simulator.

- (id)initWithMapName:(NSString *)mapName tileCacheKey:(NSString *)tileCacheKey minZoom:(float)minZoom maxZoom:(float)maxZoom

Parameters

mapName

The name of the map in TileMill, substituting dashes for spaces.

tileCacheKey

A unique cache string to use for this tile source’s tiles in the tile cache.

minZoom

The minimum zoom level supported by the map.

maxZoom

The maximum zoom level supported by the map.

Return Value

An initialized TileMill tile source.

Discussion

Initialize and return a newly allocated TileMill tile source based on a given map name. This assumes that TileMill is running on the local development computer (e.g., localhost), which will not work from an iOS device but will work in the iOS Simulator.

Declared In

RMTileMillSource.h
Inherits from RMAnnotation : NSObject
Declared in RMUserLocation.h

Overview

The RMUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existing RMUserLocation object from the userLocation property of the map view displayed in your application.

Tasks

Determining the User’s Position

  •   updating

    A Boolean value indicating whether the user’s location is currently being updated. (read-only)

    property
  •   location

    The current location of the device. (read-only)

    property
  •   heading

    The heading of the user location. (read-only)

    property

Properties

heading

The heading of the user location. (read-only)

@property (nonatomic, readonly) CLHeading *heading

Discussion

The heading of the user location. (read-only)

This property is nil if the user location tracking mode is not RMUserTrackingModeFollowWithHeading.

Declared In

RMUserLocation.h

location

The current location of the device. (read-only)

@property (nonatomic, readonly) CLLocation *location

Discussion

The current location of the device. (read-only)

This property contains nil if the map view is not currently showing the user location or if the user’s location has not yet been determined.

Declared In

RMUserLocation.h

updating

A Boolean value indicating whether the user’s location is currently being updated. (read-only)

@property (nonatomic, readonly, getter=isUpdating) BOOL updating

Discussion

A Boolean value indicating whether the user’s location is currently being updated. (read-only)

Declared In

RMUserLocation.h
Inherits from UIBarButtonItem
Declared in RMUserTrackingBarButtonItem.h

Overview

An RMUserTrackingBarButtonItem object is a specialized bar button item that allows the user to toggle through the user tracking modes. For example, when the user taps the button, the map view toggles between tracking the user with and without heading. The button also reflects the current user tracking mode if set elsewhere. This bar button item is associated to a single map view.

Tasks

Initializing

Accessing Properties

  •   mapView

    The map view associated with this bar button item.

    property

Properties

mapView

The map view associated with this bar button item.

@property (nonatomic, strong) IBOutlet RMMapView *mapView

Discussion

The map view associated with this bar button item.

Instance Methods

initWithMapView:

Initializes a newly created bar button item with the specified map view.

- (id)initWithMapView:(RMMapView *)mapView

Parameters

mapView

The map view used by this bar button item.

Return Value

The initialized bar button item.

Discussion

Initializes a newly created bar button item with the specified map view.

Declared in RMInteractiveSource.h

Overview

Developers can import RMInteractiveSource in order to enable embedded interactivity in their RMMapView, RMMBTilesSource, and RMMapBoxSource objects. Interactivity is based on the UTFGrid specification, which is a space-efficient way to encode many arbitrary values for pixel coordinates at every zoom level, allowing later retrieval based on user events on those coordinates. For example, the user touching a pixel in Spain could trigger retrieval of Spain’s flag image for display.

Interactive map views adopt the RMInteractiveMapView protocol.

Interactivity currently supports two types of output, teaser and full. These two types are ideal for master/detail interfaces or for showing a MapKit-style detail-toggling point callout.

Tasks

Querying Interactivity

Instance Methods

formattedOutputOfType:forPoint:

Returns the HTML-formatted output for a given point on a given map view.

- (NSString *)formattedOutputOfType:(RMInteractiveSourceOutputType)outputType forPoint:(CGPoint)point

Parameters

outputType

The type of feature info desired.

point

A point in the map view.

Return Value

The formatted feature output.

Discussion

Returns the HTML-formatted output for a given point on a given map view.

Declared In

RMInteractiveSource.h

supportsInteractivity

Returns YES if a map view supports interactivity features given its current tile sources.

- (BOOL)supportsInteractivity

Discussion

Returns YES if a map view supports interactivity features given its current tile sources.

Declared In

RMInteractiveSource.h
Declared in RMInteractiveSource.h

Overview

Developers can import RMInteractiveSource in order to enable embedded interactivity in their RMMapView, RMMBTilesSource, and RMMapBoxSource objects. Interactivity is based on the UTFGrid specification and is best described by this web demo.

Interactive tile sources adopt the RMInteractiveSource protocol.

Interactivity currently supports two types of output, teaser and full. These two types are ideal for master/detail interfaces or for showing a MapKit-style detail-toggling point callout.

Tasks

Querying Interactivity

Instance Methods

formattedOutputOfType:forPoint:inMapView:

Returns the HTML-formatted output for a given point on a given map view, considering the currently active interactive tile source.

- (NSString *)formattedOutputOfType:(RMInteractiveSourceOutputType)outputType forPoint:(CGPoint)point inMapView:(RMMapView *)mapView

Parameters

outputType

The type of feature info desired.

point

A point in the map view.

mapView

The map view being interacted with.

Return Value

The formatted feature output.

Discussion

Returns the HTML-formatted output for a given point on a given map view, considering the currently active interactive tile source.

Declared In

RMInteractiveSource.h

supportsInteractivity

Returns YES if a tile source supports interactivity features.

- (BOOL)supportsInteractivity

Discussion

Returns YES if a tile source supports interactivity features.

Declared In

RMInteractiveSource.h
Conforms to NSObject
Declared in RMMapViewDelegate.h

Overview

The RMMapViewDelegate protocol defines a set of optional methods that you can use to receive map-related update messages. Because many map operations require the RMMapView class to load data asynchronously, the map view calls these methods to notify your application when specific operations complete. The map view also uses these methods to request annotation layers and to manage interactions with those layers.

Tasks

Working With Annotation Layers

Responding to Map Position Changes

Responding to Map Gestures

Responding to User Annotation Gestures

Tracking the User Location

Instance Methods

afterMapMove:byUser:

Tells the delegate when a map has finished moving.

- (void)afterMapMove:(RMMapView *)map byUser:(BOOL)wasUserAction

Parameters

map

The map view that has finished moving.

wasUserAction

A Boolean indicating whether the map move was in response to a user action or not.

Discussion

Tells the delegate when a map has finished moving.

Declared In

RMMapViewDelegate.h

afterMapZoom:byUser:

Tells the delegate when a map has finished zooming.

- (void)afterMapZoom:(RMMapView *)map byUser:(BOOL)wasUserAction

Parameters

map

The map view that has finished zooming.

wasUserAction

A Boolean indicating whether the map zoom was in response to a user action or not.

Discussion

Tells the delegate when a map has finished zooming.

Declared In

RMMapViewDelegate.h

beforeMapMove:byUser:

Tells the delegate when a map is about to move.

- (void)beforeMapMove:(RMMapView *)map byUser:(BOOL)wasUserAction

Parameters

map

The map view that is about to move.

wasUserAction

A Boolean indicating whether the map move is in response to a user action or not.

Discussion

Tells the delegate when a map is about to move.

Declared In

RMMapViewDelegate.h

beforeMapZoom:byUser:

Tells the delegate when a map is about to zoom.

- (void)beforeMapZoom:(RMMapView *)map byUser:(BOOL)wasUserAction

Parameters

map

The map view that is about to zoom.

wasUserAction

A Boolean indicating whether the map zoom is in response to a user action or not.

Discussion

Tells the delegate when a map is about to zoom.

Declared In

RMMapViewDelegate.h

doubleTapOnAnnotation:onMap:

Tells the delegate when the user double-taps the layer for an annotation.

- (void)doubleTapOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map

Parameters

annotation

The annotation that was double-tapped.

map

The map view.

Discussion

Tells the delegate when the user double-taps the layer for an annotation.

Declared In

RMMapViewDelegate.h

doubleTapOnLabelForAnnotation:onMap:

Tells the delegate when the user double-taps the label for an annotation.

- (void)doubleTapOnLabelForAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map

Parameters

annotation

The annotation whose label was was double-tapped.

map

The map view.

Discussion

Tells the delegate when the user double-taps the label for an annotation.

Declared In

RMMapViewDelegate.h

doubleTapOnMap:at:

Tells the delegate when the user double-taps a map view.

- (void)doubleTapOnMap:(RMMapView *)map at:(CGPoint)point

Parameters

map

The map that was double-tapped.

point

The point at which the map was double-tapped.

Discussion

Tells the delegate when the user double-taps a map view.

Declared In

RMMapViewDelegate.h

longPressOnAnnotation:onMap:

Tells the delegate when the user long-presses the layer for an annotation.

- (void)longPressOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map

Parameters

annotation

The annotation that was long-pressed.

map

The map view.

Discussion

Tells the delegate when the user long-presses the layer for an annotation.

Declared In

RMMapViewDelegate.h

longPressOnMap:at:

Tells the delegate when the user long-presses a map view.

- (void)longPressOnMap:(RMMapView *)map at:(CGPoint)point

Parameters

map

The map that was long-pressed.

point

The point at which the map was long-pressed.

Discussion

Tells the delegate when the user long-presses a map view.

Declared In

RMMapViewDelegate.h

mapView:didChangeUserTrackingMode:animated:

Tells the delegate that the user tracking mode changed.

- (void)mapView:(RMMapView *)mapView didChangeUserTrackingMode:(RMUserTrackingMode)mode animated:(BOOL)animated

Parameters

mapView

The map view whose user tracking mode changed.

mode

The mode used to track the user’s location.

animated

If YES, the change from the current mode to the new mode is animated; otherwise, it is not. This parameter affects only tracking mode changes. Changes to the user location or heading are always animated.

Discussion

Tells the delegate that the user tracking mode changed.

Declared In

RMMapViewDelegate.h

mapView:didDeselectAnnotation:

Tells the delegate that one of its annotations was deselected.

- (void)mapView:(RMMapView *)mapView didDeselectAnnotation:(RMAnnotation *)annotation

Parameters

mapView

The map view containing the annotation.

annotation

The annotation that was deselected.

Discussion

Tells the delegate that one of its annotations was deselected.

You can use this method to track changes in the selection state of annotations.

Declared In

RMMapViewDelegate.h

mapView:didDragAnnotation:withDelta:

Tells the delegate that the user is dragging an annotation layer.

- (void)mapView:(RMMapView *)map didDragAnnotation:(RMAnnotation *)annotation withDelta:(CGPoint)delta

Parameters

map

The map view.

annotation

The annotation being dragged.

delta

The delta of movement since the last drag notification.

Discussion

Tells the delegate that the user is dragging an annotation layer.

If the screen location of the annotation layer should be changed, you are responsible for adjusting it.

Declared In

RMMapViewDelegate.h

mapView:didEndDragAnnotation:

Tells the delegate that the user has finished dragging an annotation layer.

- (void)mapView:(RMMapView *)map didEndDragAnnotation:(RMAnnotation *)annotation

Parameters

map

The map view.

annotation

The annotation that was dragged.

Discussion

Tells the delegate that the user has finished dragging an annotation layer.

If the screen position of the annotation layer has been changed since the drag operation started, you should update its coordinate to the final location in order to ensure that the annotation is displayed there going forward. Otherwise, the next time the annotations are adjusted, it will revert to its original position from before the drag.

Declared In

RMMapViewDelegate.h

mapView:didFailToLocateUserWithError:

Tells the delegate that an attempt to locate the user’s position failed.

- (void)mapView:(RMMapView *)mapView didFailToLocateUserWithError:(NSError *)error

Parameters

mapView

The map view that is tracking the user’s location.

error

An error object containing the reason why location tracking failed.

Discussion

Tells the delegate that an attempt to locate the user’s position failed.

Declared In

RMMapViewDelegate.h

mapView:didHideLayerForAnnotation:

Tells the delegate that the visible layer for an annotation has been hidden from view due to scrolling or zooming the map.

- (void)mapView:(RMMapView *)mapView didHideLayerForAnnotation:(RMAnnotation *)annotation

Parameters

mapView

The map view whose annotation layer was hidden.

annotation

The annotation whose layer was hidden.

Discussion

Tells the delegate that the visible layer for an annotation has been hidden from view due to scrolling or zooming the map.

Declared In

RMMapViewDelegate.h

mapView:didSelectAnnotation:

Tells the delegate that one of its annotations was selected.

- (void)mapView:(RMMapView *)mapView didSelectAnnotation:(RMAnnotation *)annotation

Parameters

mapView

The map view containing the annotation.

annotation

The annotation that was selected.

Discussion

Tells the delegate that one of its annotations was selected.

You can use this method to track changes in the selection state of annotations.

Declared In

RMMapViewDelegate.h

mapView:didUpdateUserLocation:

Tells the delegate that the location of the user was updated.

- (void)mapView:(RMMapView *)mapView didUpdateUserLocation:(RMUserLocation *)userLocation

Parameters

mapView

The map view that is tracking the user’s location.

userLocation

The location object representing the user’s latest location.

Discussion

Tells the delegate that the location of the user was updated.

While the showsUserLocation property is set to YES, this method is called whenever a new location update is received by the map view. This method is also called if the map view’s user tracking mode is set to RMUserTrackingModeFollowWithHeading and the heading changes.

This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework.

Declared In

RMMapViewDelegate.h

mapView:layerForAnnotation:

Returns (after creating or reusing) the layer associated with the specified annotation object.

- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation

Parameters

mapView

The map view that requested the annotation layer.

annotation

The object representing the annotation that is about to be displayed. In addition to your custom annotations, this object could be an RMUserLocation object representing the user’s current location.

Return Value

The annotation layer to display for the specified annotation or nil if you do not want to display a layer.

Discussion

Returns (after creating or reusing) the layer associated with the specified annotation object.

An annotation layer can be created using RMMapLayer and its subclasses, such as RMMarker for points and RMShape for shapes such as lines and polygons.

If the object in the annotation parameter is an instance of the RMUserLocation class, you can provide a custom layer to denote the user’s location. To display the user’s location using the default system layer, return nil.

If you do not implement this method, or if you return nil from your implementation for annotations other than the user location annotation, the map view does not display a layer for the annotation.

Declared In

RMMapViewDelegate.h

mapView:shouldDragAnnotation:

Asks the delegate whether the user should be allowed to drag the layer for an annotation.

- (BOOL)mapView:(RMMapView *)map shouldDragAnnotation:(RMAnnotation *)annotation

Parameters

map

The map view.

annotation

The annotation the user is attempting to drag.

Return Value

A Boolean value indicating whether the user should be allowed to drag the annotation layer.

Discussion

Asks the delegate whether the user should be allowed to drag the layer for an annotation.

Declared In

RMMapViewDelegate.h

mapView:willHideLayerForAnnotation:

Tells the delegate that the visible layer for an annotation is about to be hidden from view due to scrolling or zooming the map.

- (void)mapView:(RMMapView *)mapView willHideLayerForAnnotation:(RMAnnotation *)annotation

Parameters

mapView

The map view whose annotation alyer will be hidden.

annotation

The annotation whose layer will be hidden.

Discussion

Tells the delegate that the visible layer for an annotation is about to be hidden from view due to scrolling or zooming the map.

Declared In

RMMapViewDelegate.h

mapViewDidStopLocatingUser:

Tells the delegate that the map view stopped tracking the user’s location.

- (void)mapViewDidStopLocatingUser:(RMMapView *)mapView

Parameters

mapView

The map view that stopped tracking the user’s location.

Discussion

Tells the delegate that the map view stopped tracking the user’s location.

This method is called when the value of the showsUserLocation property changes to NO.

Declared In

RMMapViewDelegate.h

mapViewRegionDidChange:

Tells the delegate that the region displayed by the map view just changed.

- (void)mapViewRegionDidChange:(RMMapView *)mapView

Parameters

mapView

The map view whose visible region changed.

Discussion

Tells the delegate that the region displayed by the map view just changed.

This method is called whenever the currently displayed map region changes. During scrolling, this method may be called many times to report updates to the map position. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting scrolling performance.

Declared In

RMMapViewDelegate.h

mapViewWillStartLocatingUser:

Tells the delegate that the map view will start tracking the user’s position.

- (void)mapViewWillStartLocatingUser:(RMMapView *)mapView

Parameters

mapView

The map view that is tracking the user’s location.

Discussion

Tells the delegate that the map view will start tracking the user’s position.

This method is called when the value of the showsUserLocation property changes to YES.

Declared In

RMMapViewDelegate.h

singleTapOnMap:at:

Tells the delegate when the user taps a map view.

- (void)singleTapOnMap:(RMMapView *)map at:(CGPoint)point

Parameters

map

The map that was tapped.

point

The point at which the map was tapped.

Discussion

Tells the delegate when the user taps a map view.

Declared In

RMMapViewDelegate.h

singleTapTwoFingersOnMap:at:

Tells the delegate when the user taps a map view with two fingers.

- (void)singleTapTwoFingersOnMap:(RMMapView *)map at:(CGPoint)point

Parameters

map

The map that was tapped.

point

The center point at which the map was tapped.

Discussion

Tells the delegate when the user taps a map view with two fingers.

Declared In

RMMapViewDelegate.h

tapOnAnnotation:onMap:

Tells the delegate when the user taps the layer for an annotation.

- (void)tapOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map

Parameters

annotation

The annotation that was tapped.

map

The map view.

Discussion

Tells the delegate when the user taps the layer for an annotation.

Declared In

RMMapViewDelegate.h

tapOnCalloutAccessoryControl:forAnnotation:onMap:

Tells the delegate that the user tapped one of the annotation layer’s accessory buttons.

- (void)tapOnCalloutAccessoryControl:(UIControl *)control forAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map

Parameters

control

The control that was tapped.

annotation

The annotation whose callout control was tapped.

map

The map view containing the specified annotation.

Discussion

Tells the delegate that the user tapped one of the annotation layer’s accessory buttons.

Accessory views contain custom content and are positioned on either side of the annotation title text. If a view you specify is a descendant of the UIControl class, the map view calls this method as a convenience whenever the user taps your view. You can use this method to respond to taps and perform any actions associated with that control. For example, if your control displayed additional information about the annotation, you could use this method to present a modal panel with that information.

If your custom accessory views are not descendants of the UIControl class, the map view does not call this method.

Declared In

RMMapViewDelegate.h

tapOnLabelForAnnotation:onMap:

Tells the delegate when the user taps the label for an annotation.

- (void)tapOnLabelForAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map

Parameters

annotation

The annotation whose label was was tapped.

map

The map view.

Discussion

Tells the delegate when the user taps the label for an annotation.

Declared In

RMMapViewDelegate.h
Conforms to NSObject
Declared in RMTileCache.h

Overview

The RMTileCache protocol describes behaviors that tile caches should implement.

Tasks

Querying the Cache

Adding to the Cache

Clearing the Cache

Instance Methods

addImage:forTile:withCacheKey:

Adds a tile image to specified cache.

- (void)addImage:(UIImage *)image forTile:(RMTile)tile withCacheKey:(NSString *)cacheKey

Parameters

image

A tile image to be cached.

tile

The RMTile describing the map location of the image.

cacheKey

The key representing a certain cache.

Discussion

Adds a tile image to specified cache.

Declared In

RMTileCache.h

cachedImage:withCacheKey:

Returns an image from the cache if it exists.

- (UIImage *)cachedImage:(RMTile)tile withCacheKey:(NSString *)cacheKey

Parameters

tile

A desired RMTile.

cacheKey

The key representing a certain cache.

Return Value

An image of the tile that can be used to draw a portion of the map.

Discussion

Returns an image from the cache if it exists.

Declared In

RMTileCache.h

removeAllCachedImages

Removes all tile images from a cache.

- (void)removeAllCachedImages

Discussion

Removes all tile images from a cache.

Declared In

RMTileCache.h
Conforms to NSObject
Declared in RMTileCache.h

Overview

The RMTileCacheBackgroundDelegate protocol is for receiving notifications about background tile cache download operations.

Tasks

Instance Methods

tileCache:didBackgroundCacheTile:withIndex:ofTotalTileCount:

Sent upon caching of each tile in a background cache operation.

- (void)tileCache:(RMTileCache *)tileCache didBackgroundCacheTile:(RMTile)tile withIndex:(int)tileIndex ofTotalTileCount:(int)totalTileCount

Parameters

tileCache

The tile cache.

tile

A structure representing the tile in question.

tileIndex

The index of the tile in question, beginning with 1 and ending with totalTileCount.

totalTileCount

The total number of of tiles required for coverage of the desired geographic area.

Discussion

Sent upon caching of each tile in a background cache operation.

Declared In

RMTileCache.h

tileCache:didBeginBackgroundCacheWithCount:forTileSource:

Sent when the background caching operation begins.

- (void)tileCache:(RMTileCache *)tileCache didBeginBackgroundCacheWithCount:(int)tileCount forTileSource:(id<RMTileSource>)tileSource

Parameters

tileCache

The tile cache.

tileCount

The total number of tiles required for coverage of the desired geographic area.

tileSource

The tile source providing the tiles.

Discussion

Sent when the background caching operation begins.

Declared In

RMTileCache.h

tileCacheDidCancelBackgroundCache:

Sent when the cache download operation has completed cancellation and the cache object is safe to dispose of.

- (void)tileCacheDidCancelBackgroundCache:(RMTileCache *)tileCache

Parameters

tileCache

The tile cache.

Discussion

Sent when the cache download operation has completed cancellation and the cache object is safe to dispose of.

Declared In

RMTileCache.h

tileCacheDidFinishBackgroundCache:

Sent when all tiles have completed downloading and caching.

- (void)tileCacheDidFinishBackgroundCache:(RMTileCache *)tileCache

Parameters

tileCache

The tile cache.

Discussion

Sent when all tiles have completed downloading and caching.

Declared In

RMTileCache.h
Conforms to NSObject
Declared in RMTileSource.h

Overview

The RMTileSource protocol describes the general interface for map tile sources. Whether retrieved from network sources or provided locally, tile sources must provide some specific minimum properties.

Tasks

Configuring the Supported Zoom Levels

  •   minZoom

    The minimum zoom level supported by the tile source.

    property required method
  •   maxZoom

    The maximum zoom level supported by the tile source.

    property required method
  •   cacheable

    A Boolean value indicating whether the tiles from this source should be cached.

    property required method
  •   opaque

    A Boolean value indicating whether the tiles from this source are opaque. Setting this correctly is important when using RMCompositeSource so that alpha transparency can be preserved when compositing tile images.

    property required method

Querying the Bounds

Configuring Caching

  •   uniqueTilecacheKey

    A unique string representing the tile source in the cache in order to distinguish it from other tile sources.

    property required method

Configuring Tile Size

  •   tileSideLength

    The number of pixels along the side of a tile image for this source.

    property required method

Configuring Descriptive Properties

  •   shortName

    A short version of the tile source’s name.

    property required method
  •   longDescription

    An extended version of the tile source’s description.

    property required method
  •   shortAttribution

    A short version of the tile source’s attribution string.

    property required method
  •   longAttribution

    An extended version of the tile source’s attribution string.

    property required method

Supplying Tile Images

Properties

cacheable

A Boolean value indicating whether the tiles from this source should be cached.

@property (nonatomic, assign, getter=isCacheable) BOOL cacheable

Discussion

A Boolean value indicating whether the tiles from this source should be cached.

Declared In

RMTileSource.h

latitudeLongitudeBoundingBox

The bounding box that the tile source provides coverage for.

@property (nonatomic, readonly) RMSphericalTrapezium latitudeLongitudeBoundingBox

Discussion

The bounding box that the tile source provides coverage for.

Declared In

RMTileSource.h

longAttribution

An extended version of the tile source’s attribution string.

@property (nonatomic, readonly) NSString *longAttribution

Discussion

An extended version of the tile source’s attribution string.

Declared In

RMTileSource.h

longDescription

An extended version of the tile source’s description.

@property (nonatomic, readonly) NSString *longDescription

Discussion

An extended version of the tile source’s description.

Declared In

RMTileSource.h

maxZoom

The maximum zoom level supported by the tile source.

@property (nonatomic, assign) float maxZoom

Discussion

The maximum zoom level supported by the tile source.

Declared In

RMTileSource.h

minZoom

The minimum zoom level supported by the tile source.

@property (nonatomic, assign) float minZoom

Discussion

The minimum zoom level supported by the tile source.

Declared In

RMTileSource.h

opaque

A Boolean value indicating whether the tiles from this source are opaque. Setting this correctly is important when using RMCompositeSource so that alpha transparency can be preserved when compositing tile images.

@property (nonatomic, assign, getter=isOpaque) BOOL opaque

Discussion

A Boolean value indicating whether the tiles from this source are opaque. Setting this correctly is important when using RMCompositeSource so that alpha transparency can be preserved when compositing tile images.

Declared In

RMTileSource.h

shortAttribution

A short version of the tile source’s attribution string.

@property (nonatomic, readonly) NSString *shortAttribution

Discussion

A short version of the tile source’s attribution string.

Declared In

RMTileSource.h

shortName

A short version of the tile source’s name.

@property (nonatomic, readonly) NSString *shortName

Discussion

A short version of the tile source’s name.

Declared In

RMTileSource.h

tileSideLength

The number of pixels along the side of a tile image for this source.

@property (nonatomic, readonly) NSUInteger tileSideLength

Discussion

The number of pixels along the side of a tile image for this source.

Declared In

RMTileSource.h

uniqueTilecacheKey

A unique string representing the tile source in the cache in order to distinguish it from other tile sources.

@property (nonatomic, readonly) NSString *uniqueTilecacheKey

Discussion

A unique string representing the tile source in the cache in order to distinguish it from other tile sources.

Declared In

RMTileSource.h

Instance Methods

imageForTile:inCache:

Provide an image for a given tile location using a given cache.

- (UIImage *)imageForTile:(RMTile)tile inCache:(RMTileCache *)tileCache

Parameters

tile

The map tile in question.

tileCache

A tile cache to check first when providing the image.

Return Value

An image to display.

Discussion

Provide an image for a given tile location using a given cache.

Declared In

RMTileSource.h

tileSourceHasTile:

Check if the tile source can provide the requested tile.

- (BOOL)tileSourceHasTile:(RMTile)tile

Parameters

tile

The map tile in question.

Return Value

A Boolean value indicating whether the tile source can provide the requested tile.

Discussion

Check if the tile source can provide the requested tile.

Declared In

RMTileSource.h