MMKUserLocationLayer

@interface MMKUserLocationLayer : NSObject

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

Summary

Instance methods

- (void)setVisibleWithOn:(BOOL)on;
Sets user location visibility

- (BOOL)isVisible;
Checks if user location is visible

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

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

- (void)resetAnchor;
Resets anchor mode

- (nullable MMKCameraPosition *)cameraPosition;
Calculates the camera position that projects the current location into view

- (void)setSourceWithSource:(nullable MMKLocationViewSource *)source;
Sets/gets the data source

- (void)setDefaultSource;
Sets the data source with the global location manager

- (void)setTapListenerWithTapListener:
    (nullable id<MMKUserLocationTapListener>)tapListener;

Sets/resets the tap listener

- (void)setObjectListenerWithObjectListener:
    (nullable id<MMKUserLocationObjectListener>)objectListener;

Sets/resets the object listener

Properties

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isHeadingEnabled) BOOL headingEnabled;

Enables/disables heading mode

@property (nonatomic, readonly, getter=isAnchorEnabled) BOOL anchorEnabled;
Returns true if anchor mode is set, and false otherwise

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isAutoZoomEnabled) BOOL autoZoomEnabled;

Enables/disables auto zoom

@property (nonatomic, readonly, getter=isValid) BOOL valid;
Tells if this object is valid or no

Instance methods

setVisibleWithOn:

- (void)setVisibleWithOn:(BOOL)on;

Sets user location visibility.


isVisible

- (BOOL)isVisible;

Checks if user location is visible.


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.


resetAnchor

- (void)resetAnchor;

Resets anchor mode.


cameraPosition

- (nullable MMKCameraPosition *)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.


setSourceWithSource:

- (void)setSourceWithSource:(nullable MMKLocationViewSource *)source;

Sets/gets the data source.


setDefaultSource

- (void)setDefaultSource;

Sets the data source with the global location manager


setTapListenerWithTapListener:

- (void)setTapListenerWithTapListener:
    (nullable id<MMKUserLocationTapListener>)tapListener;

Sets/resets the tap listener.

The class does not retain the object in the 'tapListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


setObjectListenerWithObjectListener:

- (void)setObjectListenerWithObjectListener:
    (nullable id<MMKUserLocationObjectListener>)objectListener;

Sets/resets the object listener.

The class does not retain the object in the 'objectListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


Properties

headingEnabled

@property (nonatomic, assign, unsafe_unretained, 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.


anchorEnabled

@property (nonatomic, readonly, getter=isAnchorEnabled) BOOL anchorEnabled;

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


autoZoomEnabled

@property (nonatomic, assign, unsafe_unretained, readwrite,
          getter=isAutoZoomEnabled) BOOL autoZoomEnabled;

Enables/disables auto zoom.


valid

@property (nonatomic, 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.