MaplyViewControllerDelegate
Objective-C
@protocol MaplyViewControllerDelegate <NSObject>
Swift
protocol MaplyViewControllerDelegate : NSObjectProtocol
A protocol to fill out for selection and tap messages from the MaplyViewController.
Fill out the protocol when you want to get back selection and tap messages. All the methods are optional.
-
Called when the user taps on or near an object.
You’re given the object you passed in originally, such as a MaplyScreenMarker. You can set a userObject on most of these to put your own data in there for tracking.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didSelect:(NSObject *_Nonnull)selectedObj;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didSelect selectedObj: NSObject)
-
User selected a given object and tapped at a given location.
This is called when the user selects an object. It differs from maplyViewController:didSelect: in that it passes on the location (in the local coordinate system) and the position on screen.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didSelect:(NSObject *_Nonnull)selectedObj atLoc:(MaplyCoordinate)coord onScreen:(CGPoint)screenPt;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didSelect selectedObj: NSObject, atLoc coord: MaplyCoordinate, onScreen screenPt: CGPoint)
Parameters
viewC
View Controller that saw the selection.
selectedObj
The object selected. Probably one of MaplyVectorObject or MaplyScreenLabel or so on.
coord
Location in the local coordinate system where the user tapped.
screenPt
Location on screen where the user tapped.
-
User selected one or more objects at a given location.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC allSelect:(NSArray *_Nonnull)selectedObjs atLoc:(MaplyCoordinate)coord onScreen:(CGPoint)screenPt;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, allSelect selectedObjs: [Any], atLoc coord: MaplyCoordinate, onScreen screenPt: CGPoint)
Parameters
viewC
View Controller that saw the selection(s).
selectedObjs
The object(s) selected. Probably one of MaplyVectorObject or MaplyScreenLabel or so on.
coord
Location in the local coordinate system where the user tapped.
screenPt
Location on screen where the user tapped.
-
User tapped at a given location.
This is a tap at a specific location on the map. This won’t be called if they tapped and selected, just for taps.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didTapAt:(MaplyCoordinate)coord;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didTapAt coord: MaplyCoordinate)
-
Called when the map starts moving.
This is called when something (probably the user) starts moving the map.
Declaration
Objective-C
- (void)maplyViewControllerDidStartMoving:(MaplyViewController *_Nonnull)viewC userMotion:(_Bool)userMotion;
Swift
optional func maplyViewControllerDidStartMoving(_ viewC: MaplyViewController, userMotion: Bool)
Parameters
viewC
The map view controller.
userMotion
Set if this is motion being caused by the user, rather than a call to set location.
-
Called when the map stops moving.
This is called when the map stops moving. It passes in the corners of the current viewspace.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didStopMoving:(MaplyCoordinate *_Nonnull)corners userMotion:(_Bool)userMotion;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didStopMoving corners: UnsafeMutablePointer<MaplyCoordinate>, userMotion: Bool)
Parameters
viewC
The globe view controller.
userMotion
Set if this is motion being caused by the user, rather than a call to set location.
corners
An array of length 4 containing the corners of the view space (lower left, lower right, upper right, upper left). If any of those corners does not intersect the map (think zoomed out), its values are set to MAXFLOAT.
-
Called whenever the viewpoint moves.
This is called whenever the viewpoint moves. That includes user motion as well as animations.
It may be triggered as often as every frame. If that’s a problem, use one of the other variants.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didMove:(MaplyCoordinate *_Nonnull)corners;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didMove corners: UnsafeMutablePointer<MaplyCoordinate>)
Parameters
viewC
The map view controller.
corners
An array of length 4 containing the corners of the view space (lower left, lower right, upper right, upper left). If any of those corners does not intersect the globe (think zoomed out), its values are set to MAXFLOAT.
-
Called when the user taps on one of your annotations.
This is called when the user taps on an annotation.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didTapAnnotation:(MaplyAnnotation *_Nonnull)annotation;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didTap annotation: MaplyAnnotation)
Parameters
annotation
Which annotation they tapped on.
-
Deprecated
Old version for compatibility. Use tap instead.
Declaration
Objective-C
- (void)maplyViewController:(MaplyViewController *_Nonnull)viewC didClickAnnotation:(MaplyAnnotation *_Nonnull)annotation;
Swift
optional func maplyViewController(_ viewC: MaplyViewController, didClick annotation: MaplyAnnotation)