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 non-marker or 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

dragState

The current drag state of the annotation layer.

@property (nonatomic, assign) RMMapLayerDragState dragState

Discussion

The current drag state of the annotation layer.

To support drag operations, you must override the implementation of this property and update the drag state at the following times:

When the drag state changes to RMMapLayerDragStateStarting, you should set the state to RMMapLayerDragStateDragging. If you perform an animation to indicate the beginning of a drag, you should perform that animation before changing the state. Changing the state to the new value lets the map know that your animations are done.

When the state changes to either RMMapLayerDragStateCanceling or RMMapLayerDragStateEnding, set the state to RMMapLayerDragStateNone. If you perform an animation at the end of a drag, you should perform that animation before changing the state.

Changing the state to the RMMapLayerDragStateDragging or RMMapLayerDragStateNone value is the way to signal to the map view that you are done with any animations you wanted to perform. For example, when a drag operation begins for a marker, the RMMarker class executes an animation to lift the marker off the map. Similarly, when the marker is dropped, the class performs a drop animation. Even if you do not perform any animations, you should still change the value of this property to reflect the correct state.

You must not try to abort a new drag operation by changing the state from RMMapLayerDragStateStarting to RMMapLayerDragStateNone. If you do not want your annotation layer to be draggable, return NO from the map view delegate’s implementation of mapView:shouldDragAnnotation:.

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