Google Maps SDK for iOS

GMSMarker Class Reference

GMSMarker Class Reference

Overview

A marker is an icon placed at a particular point on the map's surface.

A marker's icon is drawn oriented against the device's screen rather than the map's surface; i.e., it will not necessarily change orientation due to map rotations, tilting, or zooming.

Inherits GMSOverlay.

Static Public Member Functions

(instancetype) + markerWithPosition:
 Convenience constructor for a default marker.
(UIImage *) + markerImageWithColor:
 Creates a tinted version of the default marker image for use as an icon.

Properties

CLLocationCoordinate2D position
 Marker position.
NSString * snippet
 Snippet text, shown beneath the title in the info window when selected.
UIImage * icon
 Marker icon to render.
CGPoint groundAnchor
 The ground anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.
CGPoint infoWindowAnchor
 The info window anchor specifies the point in the icon image at which to anchor the info window, which will be displayed directly above this point.
GMSMarkerAnimation appearAnimation
 Controls the animation used when this marker is placed on a GMSMapView (default kGMSMarkerAnimationNone, no animation).
BOOL draggable
 Controls whether this marker can be dragged interactively (default NO).
BOOL flat
 Controls whether this marker should be flat against the Earth's surface (YES) or a billboard facing the camera (NO, default).
CLLocationDegrees rotation
 Sets the rotation of the marker in degrees clockwise about the marker's anchor point.
float opacity
 Sets the opacity of the marker, between 0 (completely transparent) and 1 (default) inclusive.
id userData
 Marker data.
GMSMarkerLayerlayer
 Provides the Core Animation layer for this GMSMarker.
GMSPanoramaViewpanoramaView
 The panoramaView specifies which panorama view will attempt to show this marker.
NSString * title
 Title, a short description of the overlay.
GMSMapViewmap
 The map this overlay is on.
BOOL tappable
 If this overlay should cause tap notifications.
int zIndex
 Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays.

Member Function Documentation

+ (instancetype) markerWithPosition: (CLLocationCoordinate2D)  position

Convenience constructor for a default marker.

+ (UIImage *) markerImageWithColor: (UIColor *)  color

Creates a tinted version of the default marker image for use as an icon.


Property Documentation

- (CLLocationCoordinate2D) position [read, write, assign]

Marker position.

Animated.

- (NSString*) snippet [read, write, copy]

Snippet text, shown beneath the title in the info window when selected.

- (UIImage*) icon [read, write, assign]

Marker icon to render.

If left nil, uses a default SDK place marker.

Supports animated images, but each frame must be the same size or the behavior is undefined.

Supports the use of alignmentRectInsets to specify a reduced tap area. This also redefines how anchors are specified. For an animated image the value for the animation is used, not the individual frames.

- (CGPoint) groundAnchor [read, write, assign]

The ground anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.

This point is specified within the continuous space [0.0, 1.0] x [0.0, 1.0], where (0,0) is the top-left corner of the image, and (1,1) is the bottom-right corner.

If the image has non-zero alignmentRectInsets, the top-left and bottom-right mentioned above refer to the inset section of the image.

- (CGPoint) infoWindowAnchor [read, write, assign]

The info window anchor specifies the point in the icon image at which to anchor the info window, which will be displayed directly above this point.

This point is specified within the same space as groundAnchor.

- (GMSMarkerAnimation) appearAnimation [read, write, assign]

Controls the animation used when this marker is placed on a GMSMapView (default kGMSMarkerAnimationNone, no animation).

- (BOOL) draggable [read, write, assign]

Controls whether this marker can be dragged interactively (default NO).

- (BOOL) flat [read, write, assign]

Controls whether this marker should be flat against the Earth's surface (YES) or a billboard facing the camera (NO, default).

- (CLLocationDegrees) rotation [read, write, assign]

Sets the rotation of the marker in degrees clockwise about the marker's anchor point.

The axis of rotation is perpendicular to the marker. A rotation of 0 corresponds to the default position of the marker. Animated.

When the marker is flat on the map, the default position is north aligned and the rotation is such that the marker always remains flat on the map. When the marker is a billboard, the default position is pointing up and the rotation is such that the marker is always facing the camera.

- (float) opacity [read, write, assign]

Sets the opacity of the marker, between 0 (completely transparent) and 1 (default) inclusive.

- (id) userData [read, write, assign]

Marker data.

You can use this property to associate an arbitrary object with this marker. Google Maps SDK for iOS neither reads nor writes this property.

Note that userData should not hold any strong references to any Maps objects, otherwise a loop may be created (preventing ARC from releasing objects).

- (GMSMarkerLayer*) layer [read, assign]

Provides the Core Animation layer for this GMSMarker.

- (GMSPanoramaView*) panoramaView [read, write, assign]

The panoramaView specifies which panorama view will attempt to show this marker.

Note that if the marker's position is too far away from the panoramaView's current panorama location, it will not be displayed as it will be too small. Can be set to nil to remove the marker from any current panorama view it is attached to. A marker can be shown on both a panorama and a map at the same time.

- (NSString*) title [read, write, copy, inherited]

Title, a short description of the overlay.

Some overlays, such as markers, will display the title on the map. The title is also the default accessibility text.

- (GMSMapView*) map [read, write, assign, inherited]

The map this overlay is on.

Setting this property will add the overlay to the map. Setting it to nil removes this overlay from the map. An overlay may be active on at most one map at any given time.

- (BOOL) tappable [read, write, assign, inherited]

If this overlay should cause tap notifications.

Some overlays, such as markers, will default to being tappable.

- (int) zIndex [read, write, assign, inherited]

Higher zIndex value overlays will be drawn on top of lower zIndex value tile layers and overlays.

Equal values result in undefined draw ordering. Markers are an exception that regardless of zIndex, they will always be drawn above tile layers and other non-marker overlays; they are effectively considered to be in a separate z-index group compared to other overlays.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.