RMMarker Class Reference
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
property -
textForegroundColor
property -
textBackgroundColor
property -
+ defaultFont
Creating Markers With Images
Creating Markers Using Mapbox Images
-
– initWithMapboxMarkerImage
-
– initWithMapboxMarkerImage:
-
– initWithMapboxMarkerImage:tintColor:
-
– initWithMapboxMarkerImage:tintColor:size:
-
– initWithMapboxMarkerImage:tintColorHex:
-
– initWithMapboxMarkerImage:tintColorHex:sizeString:
-
+ clearCachedMapboxMarkers
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
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
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
, orlarge
.
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
to1
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
to1
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