TGMapViewDelegate
@protocol TGMapViewDelegate <NSObject>
A map view delegate can receive various map events.
Note
All of these methods are called from main thread, these methods are all optional.-
Receive the result from
-[TGMapView pickFeatureAt:]
.Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView didSelectFeature:(nullable TGFeatureProperties *)feature atScreenPosition:(CGPoint)position;
Swift
optional func mapView(_ mapView: TGMapView, didSelectFeature feature: [String : String]?, atScreenPosition position: CGPoint)
Parameters
mapView
The map view instance.
feature
A dictionary of properties of the picked feature or
nil
if no feature was found.position
The view position where the feature was picked.
-
Receive the result from
-[TGMapView pickLabelAt:]
.Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView didSelectLabel:(nullable TGLabelPickResult *)labelPickResult atScreenPosition:(CGPoint)position;
Swift
optional func mapView(_ mapView: TGMapView, didSelectLabel labelPickResult: TGLabelPickResult?, atScreenPosition position: CGPoint)
Parameters
mapView
The map view instance.
labelPickResult
A result object with information about the picked label or
nil
if no label was found.position
The view position where the label was picked.
-
Receive the result from
-[TGMapView pickMarkerAt:]
.Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView didSelectMarker:(nullable TGMarkerPickResult *)markerPickResult atScreenPosition:(CGPoint)position;
Swift
optional func mapView(_ mapView: TGMapView, didSelectMarker markerPickResult: TGMarkerPickResult?, atScreenPosition position: CGPoint)
Parameters
mapView
The map view instance.
markerPickResult
A result object with information about the picked marker or
nil
if no marker was found.position
The view position where the marker was picked.
-
Receive the result from
-[TGMapView captureScreenshot:]
.Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView didCaptureScreenshot:(nonnull UIImage *)screenshot;
Swift
optional func mapView(_ mapView: TGMapView, didCaptureScreenshot screenshot: UIImage)
Parameters
mapView
The map view instance.
screenshot
The image object representing the screenshot.
-
Called after a scene has been loaded or updated.
See:
-[TGMapView loadSceneAsyncFromURL:withUpdates:]
-[TGMapView loadSceneFromYAML:relativeToURL:withUpdates:]
-[TGMapView loadSceneAsyncFromYAML:relativeToURL:withUpdates:]
-[TGMapView updateSceneAsync:]
Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView didLoadScene:(int)sceneID withError:(nullable NSError *)sceneError;
Swift
optional func mapView(_ mapView: TGMapView, didLoadScene sceneID: Int32, withError sceneError: Error?)
Parameters
mapView
The map view instance.
sceneID
The ID of the scene that was loaded or updated.
sceneError
Any error encountered while loading or updating the scene.
-
Called immediately before the displayed map region moves.
Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
Swift
optional func mapView(_ mapView: TGMapView, regionWillChangeAnimated animated: Bool)
Parameters
mapView
The map view instance.
animated
If YES the move will be animated over time, if NO the move will happen immediately.
-
Called after the displayed map region moves.
Declaration
Objective-C
- (void)mapView:(nonnull TGMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
Swift
optional func mapView(_ mapView: TGMapView, regionDidChangeAnimated animated: Bool)
Parameters
mapView
The map view instance.
animated
If YES the move was animated over time, if NO the move happened immediately.