Class YMKUserLocationLayer

Use the UserLocationLayer interface to manage the location icon: its appearance, following mode, data source and so on.

Instance Methods

- cameraPosition

Calculates the camera position that projects the current location into view.

- isVisible

Checks if user location is visible.

- resetAnchor

Resets anchor mode.

- setAnchorWithAnchorNormal:anchorCourse:

Sets the anchor to the specified position in pixels and enables Anchor mode.

- setObjectListenerWithObjectListener:

Sets/resets the object listener.

- setSourceWithSource:

Sets/gets the data source.

- setTapListenerWithTapListener:

Sets/resets the tap listener.

- setVisibleWithOn:

Sets user location visibility.

Properties

anchorEnabled

Returns true if anchor mode is set, and false otherwise.

autoZoomEnabled

Enables/disables auto zoom.

headingEnabled

Enables/disables heading mode.

valid

Tells if this object is valid or no.

Method Detail

-cameraPosition

- (nullable YMKCameraPosition *)cameraPosition

Calculates the camera position that projects the current location into view.

If the current location is unknown, returns none. If the current location is known, returns the camera position that displays the location position.

-isVisible

- (BOOL)isVisible

Checks if user location is visible.

-resetAnchor

- (void)resetAnchor

Resets anchor mode.

-setAnchorWithAnchorNormal:anchorCourse:

- (void)setAnchorWithAnchorNormal:(CGPoint)anchorNormal
                     anchorCourse:(CGPoint)anchorCourse 

Sets the anchor to the specified position in pixels and enables Anchor mode.

(0, 0) denotes the top-left corner of the screen.
Parameters:
anchorNormal

The anchor position when the app is not on a steady course; usually, the center of the screen.

anchorCourse

An anchor position near the bottom line for steady course mode.

-setObjectListenerWithObjectListener:

- (void)setObjectListenerWithObjectListener:(nullable id< YMKUserLocationObjectListener >)objectListener 

Sets/resets the object listener.

Remark:
Parameters:
objectListener

has optional type, it may be uninitialized.

-setSourceWithSource:

- (void)setSourceWithSource:(nullable YMKLocationViewSource *)source 

Sets/gets the data source.

Remark:
Parameters:
source

has optional type, it may be uninitialized.

-setTapListenerWithTapListener:

- (void)setTapListenerWithTapListener:(nullable id< YMKUserLocationTapListener >)tapListener 

Sets/resets the tap listener.

Remark:
Parameters:
tapListener

has optional type, it may be uninitialized.

-setVisibleWithOn:

- (void)setVisibleWithOn:(BOOL)on 

Sets user location visibility.

Property Detail

anchorEnabled

(assign, readonly, getter=isAnchorEnabled) BOOL anchorEnabled

Returns true if anchor mode is set, and false otherwise.

autoZoomEnabled

(assign, readwrite, getter=isAutoZoomEnabled) BOOL autoZoomEnabled

Enables/disables auto zoom.

headingEnabled

(assign, readwrite, getter=isHeadingEnabled) BOOL headingEnabled

Enables/disables heading mode.

If heading mode is enabled, the map is rotated. If heading mode is disabled, the location icon is rotated.

valid

(assign, readonly, getter=isValid) BOOL valid

Tells if this object is valid or no.

Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.