MMKUserLocationLayer

class MMKUserLocationLayer : NSObject

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

Summary

Instance methods

func setVisibleWithOn(_ on: Bool)
Sets user location visibility

func isVisible() -> Bool
Checks if user location is visible

func setAnchorWithAnchorNormal(_ anchorNormal: CGPoint, anchorCourse: CGPoint)
Sets the anchor to the specified position in pixels and enables Anchor mode

func resetAnchor()
Resets anchor mode

func cameraPosition() -> MMKCameraPosition?
Calculates the camera position that projects the current location into view

func setSourceWith( source: MMKLocationViewSource_?)
Sets/gets the data source

func setDefaultSource()
Sets the data source with the global location manager

func setTapListenerWith( tapListener: MMKUserLocationTapListener_?)
Sets/resets the tap listener

func setObjectListenerWith( objectListener: MMKUserLocationObjectListener_?)
Sets/resets the object listener

Properties

var isHeadingEnabled: Bool { get set }
Enables/disables heading mode

var isAnchorEnabled: Bool { get }
Returns true if anchor mode is set, and false otherwise

var isAutoZoomEnabled: Bool { get set }
Enables/disables auto zoom

var isValid: Bool { get }
Tells if this object is valid or no

Instance methods

setVisibleWithOn(_:)

func setVisibleWithOn(_ on: Bool)

Sets user location visibility.


isVisible()

func isVisible() -> Bool

Checks if user location is visible.


setAnchorWithAnchorNormal(_:anchorCourse:)

func setAnchorWithAnchorNormal(_ anchorNormal: CGPoint, anchorCourse: CGPoint)

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()

func resetAnchor()

Resets anchor mode.


cameraPosition()

func cameraPosition() -> MMKCameraPosition?

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.


setSourceWith(_:)

func setSourceWith( source: MMKLocationViewSource_?)

Sets/gets the data source.


setDefaultSource()

func setDefaultSource()

Sets the data source with the global location manager


setTapListenerWith(_:)

func setTapListenerWith( tapListener: MMKUserLocationTapListener_?)

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.


setObjectListenerWith(_:)

func setObjectListenerWith( objectListener: MMKUserLocationObjectListener_?)

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

isHeadingEnabled

var isHeadingEnabled: Bool { get set }

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


isAnchorEnabled

var isAnchorEnabled: Bool { get }

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


isAutoZoomEnabled

var isAutoZoomEnabled: Bool { get set }

Enables/disables auto zoom.


isValid

var isValid: Bool { get }

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.