google maps - GMSMarker icon from center (iOS) -
i switched apple maps google maps. issue can't seem find answer how make icon gmsmarker start center rather bottom of image.
an example of mean current location dot icon starts centered @ coordinates meant express. gmsmarkers icons start bottom of icon.
you can change start position of marker icon property groundanchor
.
google maps sdk ios documentation:
the ground anchor specifies point in icon image anchored marker's position on earth's surface. point specified within continuous space [0.0, 1.0] x [0.0, 1.0], (0,0) top-left corner of image, , (1,1) bottom-right corner.
example:
the below example rotates marker 90°. setting groundanchor property 0.5,0.5 causes marker rotated around center, instead of base.
cllocationcoordinate2d position = cllocationcoordinate2dmake(51.5, -0.127); cllocationdegrees degrees = 90; gmsmarker *london = [gmsmarker markerwithposition:position]; london.groundanchor = cgpointmake(0.5, 0.5); london.rotation = degrees; london.map = mapview_;
Comments
Post a Comment