VMMapViewDelegate
@objc
public protocol VMMapViewDelegate : NSObjectProtocol
Protocol for receiving VMMapView callbacks
Since
1.1-
Called when the map view has finished loading
Since
1.2.1Declaration
Swift
@objc optional func didFinishLoadingMapView(_ mapView: VMMapView)Parameters
mapViewthe mapView
-
Called when the mapview fails to load
Since
1.2.1Declaration
Swift
@objc optional func didFailToLoadMapView(error: Error)Parameters
errorthe error that caused the failure
-
Called to see if its possible to select a unit
Declaration
Swift
@objc optional func canSelectUnit(_ unit: VMMSMapUnit) -> BoolParameters
unitthe unit to select
Return Value
true to allow selection, false otherwise
-
Called after a new unit has been selected
Declaration
Swift
@objc optional func didSelectUnit(_ unit: VMMSMapUnit?)Parameters
unitthe unit that is selected
-
Called when user taps on a point in the map.
Since
2.0Declaration
Swift
@objc optional func didTapAtLocationCoordinate(_ location: CLLocationCoordinate2D)Parameters
locationthe location of the tap
-
Called to verify that it’s OK to update the camera position. You might use this method to restrict camera movement.
Since
1.2Declaration
Swift
@objc optional func shouldChangeCameraPosition(toLocation newLocation: CLLocationCoordinate2D, toBearing newBearing: Double, toTilt newTilt: Double) -> BoolParameters
newLocationthe newLocation
newBearingthe new bearing
newTiltthe new tilt
Return Value
true to proceed with changeing the camera
-
Called when the map position changes
Declaration
Swift
@objc optional func didChangeCameraPosition(toLocation newLocation: CLLocationCoordinate2D, toZoom newZoom: Float, toBearing newBearing: Double, toTilt newTilt: Double)Parameters
newLocationthe new map location
newZoomthe new map zoom
newBearingthe new map bearing
newTiltthe new map tilt
-
Called to get stroke color for a polyline, should NOT have transparency
Declaration
Swift
@objc optional func strokeColorForPolyline(_ line: VMPolyline) -> UIColor?Parameters
linethe line
Return Value
the color of the line, or nil to use defaults
-
Called to get the line width for a polyline
Declaration
Swift
@objc optional func lineWidthForPolyline(_ line: VMPolyline) -> FloatParameters
linethe line
Return Value
the width
-
Called to get transparency value for a polyline
Declaration
Swift
@objc optional func alphaForPolyline(_ line: VMPolyline) -> FloatParameters
linethe line
Return Value
the transparency value (0 for invisible, 1.0 to fully opaque)
-
Called to provide a custom view for a point annotation
Declaration
Swift
@objc optional func viewForPointAnnotation(_ annotation: VMPointAnnotation) -> UIView?Parameters
annotationthe annotation
Return Value
the custom view
-
Called to provide a custom image for a point annotation
Declaration
Swift
@objc optional func imageForPointAnnotation(_ annotation: VMPointAnnotation) -> UIImage?Parameters
annotationthe annotation
Return Value
the custom image
-
Called when a map annotation is selected
Since
1.2Declaration
Swift
@objc optional func didSelectAnnotation(_ annotation: VMMapAnnotation)Parameters
annotationthe annotation
-
Called to provide a custom view for a annotation callout
Since
1.4Declaration
Swift
@objc optional func calloutViewForPointAnnotation(_ annotation: VMPointAnnotation) -> VMAnnotationCalloutView?Parameters
annotationthe annotation
Return Value
the custom view
-
Determine if a callout should be shown for a particular annotation
Since
1.4Declaration
Swift
@objc optional func canShowCalloutViewForPointAnnotation(_ annotation: VMPointAnnotation) -> BoolParameters
annotationthe annotation
Return Value
true if the callout should show
VMMapViewDelegate Protocol Reference