RMMapView Class Reference
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
-
delegate
property
Configuring Map Behavior
-
draggingEnabled
property -
bouncingEnabled
property -
zoomingInPivotsAroundCenter
property -
decelerationMode
property
Supporting Retina Displays
-
adjustTilesForRetinaDisplay
property
Attributing Map Data
-
hideAttribution
property
Fine-Tuning the Map Appearance
-
missingTilesDepth
property -
backgroundView
property -
– setBackgroundImage:
-
debugTiles
property -
showLogoBug
property
Initializing a Map View
-
– initWithFrame:
-
– initWithFrame:andTilesource:
-
– initWithFrame:andTilesource:centerCoordinate:zoomLevel:maxZoomLevel:minZoomLevel:backgroundImage:
Panning the Map
-
centerCoordinate
property -
centerProjectedPoint
property -
– setCenterCoordinate:animated:
-
– setCenterProjectedPoint:animated:
-
– moveBy:
Zooming the Map
-
zoom
property -
minZoom
property -
maxZoom
property -
– setZoom:animated:
-
– setZoom:atCoordinate:animated:
-
– zoomByFactor:near:animated:
-
– zoomInToNextNativeZoomAt:animated:
-
– zoomOutToNextNativeZoomAt:animated:
-
– zoomWithLatitudeLongitudeBoundsSouthWest:northEast:animated:
Querying the Map Bounds
Constraining the Map
Capturing Snapshots of the Map View
Annotating the Map
-
annotations
property -
visibleAnnotations
property -
– addAnnotation:
-
– addAnnotations:
-
– removeAnnotation:
-
– removeAnnotations:
-
– removeAllAnnotations
-
– mapPositionForAnnotation:
-
– selectAnnotation:animated:
-
– deselectAnnotation:animated:
-
selectedAnnotation
property
Configuring Annotation Clustering
-
clusteringEnabled
property -
)
property -
positionClusterMarkersAtTheGravityCenter
property
Managing Tile Sources
-
tileSource
property -
tileSources
property -
– addTileSource:
-
– addTileSource:atIndex:
-
– removeTileSource:
-
– removeTileSourceAtIndex:
-
– moveTileSourceAtIndex:toIndex:
-
– setHidden:forTileSource:
-
– setHidden:forTileSourceAtIndex:
-
– setAlpha:forTileSource:
-
– setAlpha:forTileSourceAtIndex:
-
– reloadTileSource:
-
– reloadTileSourceAtIndex:
Managing Tile Caching Behavior
-
tileCache
property -
– removeAllCachedImages
Converting Map Coordinates
-
– projectedPointToPixel:
-
– coordinateToPixel:
-
– pixelToProjectedPoint:
-
– pixelToCoordinate:
-
– coordinateToProjectedPoint:
-
– projectedPointToCoordinate:
-
– latitudeLongitudeBoundingBoxForTile:
Tracking the User Location
-
showsUserLocation
property -
userLocation
property -
userLocationVisible
property -
userTrackingMode
property -
displayHeadingCalibration
property -
– setUserTrackingMode:animated:
Properties
)
Whether to order markers on the z-axis according to increasing y-position. Defaults to YES
.
@property (nonatomic, assign) BOOL orderMarkersByYPosition DEPRECATED_MSG_ATTRIBUTE ( "use -[RMMapViewDelegate annotationSortingComparatorForMapView:] for annotation sorting" )
Discussion
Whether to order markers on the z-axis according to increasing y-position. Defaults to YES
.
Warning: This property has been deprecated in favor of [RMMapViewDelegate annotationSortingComparatorForMapView:].
Declared In
RMMapView.h
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
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.
On iOS 8 and above, your app must specify a value for NSLocationWhenInUseUsageDescription
in its Info.plist
to satisfy the requirements of the underlying Core Location framework when enabling this property.
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
Parameters
- frame
The frame with which to initialize the map view.
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. 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 relative map position for a given annotation.
- (CGPoint)mapPositionForAnnotation:(RMAnnotation *)annotation
Parameters
- annotation
The annotation for which to return the current position.
Return Value
The screen position of the annotation.
Discussion
The relative map 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
setAlpha:forTileSource:
Change a tile source’s alpha value.
- (void)setAlpha:(CGFloat)alpha forTileSource:(id<RMTileSource>)tileSource
Parameters
- alpha
The desired alpha value.
- tileSource
The tile source to change.
Discussion
Change a tile source’s alpha value.
Declared In
RMMapView.h
setAlpha:forTileSourceAtIndex:
Change the alpha value of a tile source at a given index.
- (void)setAlpha:(CGFloat)alpha forTileSourceAtIndex:(NSUInteger)index
Parameters
- alpha
The desired alpha value.
- index
The index of the tile source to change.
Discussion
Change the alpha value of a tile source at a given index.
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
Parameters
- backgroundImage
The image to use.
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.
Setting the tracking mode to RMUserTrackingModeFollow
or RMUserTrackingModeFollowWithHeading
causes the map view to center the map on that location and begin tracking the user’s location. If the map is zoomed out, the map view automatically zooms in on the user’s location, effectively changing the current visible region.
On iOS 8 and above, your app must specify a value for NSLocationWhenInUseUsageDescription
in its Info.plist
to satisfy the requirements of the underlying Core Location framework when tracking the user location.
Declared In
RMMapView.h
setZoom:animated:
Set zoom level, optionally with an animation.
- (void)setZoom:(float)newZoom animated:(BOOL)animated
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
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
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