VBDMapViewDelegate
@protocol VBDMapViewDelegate <NSObject>
The VBDMapViewDelegate protocol defines a set of optional methods that you can use to receive map-related update messages. Because many map operations require the VBDMapView class to load data asynchronously, the map view calls these methods to notify your application when specific operations complete. The map view also uses these methods to request annotation marker symbology and to manage interactions with those markers.
-
Tells the delegate that the region displayed by the map view is about to change.
This method is called whenever the currently displayed map region will start changing.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView regionWillChangeAnimated:(BOOL)animated;Parameters
mapViewThe map view whose visible region will change.
animatedWhether the change will cause an animated effect on the map.
-
Tells the delegate that the region displayed by the map view is changing.
This method is called whenever the currently displayed map region changes. During movement, this method may be called many times to report updates to the map position. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance.
Declaration
Objective-C
- (void)mapViewRegionIsChanging:(nonnull VBDMapView *)mapView;Parameters
mapViewThe map view whose visible region is changing.
-
Tells the delegate that the region displayed by the map view just changed.
This method is called whenever the currently displayed map region has finished changing.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView regionDidChangeAnimated:(BOOL)animated;Parameters
mapViewThe map view whose visible region changed.
animatedWhether the change caused an animated effect on the map.
-
Tells the delegate that the map view will begin to load.
This method is called whenever the map view starts loading, including when a new style has been set and the map must reload.
Declaration
Objective-C
- (void)mapViewWillStartLoadingMap:(nonnull VBDMapView *)mapView;Parameters
mapViewThe map view that is starting to load.
-
Tells the delegate that the map view has finished loading.
This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload.
Declaration
Objective-C
- (void)mapViewDidFinishLoadingMap:(nonnull VBDMapView *)mapView;Parameters
mapViewThe map view that has finished loading.
-
Tells the delegate that the map view will begin tracking the user’s location.
This method is called when the value of the
showsUserLocationproperty changes toYES.Declaration
Objective-C
- (void)mapViewWillStartLocatingUser:(nonnull VBDMapView *)mapView;Parameters
mapViewThe map view that is tracking the user’s location.
-
Tells the delegate that the map view has stopped tracking the user’s location.
This method is called when the value of the
showsUserLocationproperty changes toNO.Declaration
Objective-C
- (void)mapViewDidStopLocatingUser:(nonnull VBDMapView *)mapView;Parameters
mapViewThe map view that is tracking the user’s location.
-
Tells the delegate that the location of the user was updated.
While the
showsUserLocationproperty is set toYES, this method is called whenever a new location update is received by the map view. This method is also called if the map view’s user tracking mode is set toVBDUserTrackingModeFollowWithHeadingand the heading changes, or if it is set toVBDUserTrackingModeFollowWithCourseand the course changes.This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView didUpdateUserLocation:(nullable VBDUserLocation *)userLocation;Parameters
mapViewThe map view that is tracking the user’s location.
userLocationThe location object representing the user’s latest location. This property may be
nil. -
Tells the delegate that an attempt to locate the user’s position failed.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView didFailToLocateUserWithError:(nonnull NSError *)error;Parameters
mapViewThe map view that is tracking the user’s location.
errorAn error object containing the reason why location tracking failed.
-
Tells the delegate that the map view’s user tracking mode has changed.
This method is called after the map view asynchronously changes to reflect the new user tracking mode, for example by beginning to zoom or rotate.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView didChangeUserTrackingMode:(VBDUserTrackingMode)mode animated:(BOOL)animated;Parameters
mapViewThe map view that changed its tracking mode.
modeThe new tracking mode.
animatedWhether the change caused an animated effect on the map.
-
Returns an image object to use for the marker for the specified point annotation object.
Declaration
Objective-C
- (nullable VBDAnnotationImage *)mapView:(nonnull VBDMapView *)mapView imageForAnnotation:(nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view that requested the annotation image.
annotationThe object representing the annotation that is about to be displayed.
Return Value
The image object to display for the specified annotation or
nilif you want to display the default marker image. -
Returns the alpha value to use when rendering a shape annotation. Defaults to
1.0.Declaration
Objective-C
- (CGFloat)mapView:(nonnull VBDMapView *)mapView alphaForShapeAnnotation:(nonnull VBDShape *)annotation;Parameters
mapViewThe map view rendering the shape annotation.
annotationThe annotation being rendered.
Return Value
An alpha value between
0and1.0. -
Returns the stroke color to use when rendering a shape annotation. Defaults to the map view’s tint color.
Declaration
Objective-C
- (nonnull UIColor *)mapView:(nonnull VBDMapView *)mapView strokeColorForShapeAnnotation:(nonnull VBDShape *)annotation;Parameters
mapViewThe map view rendering the shape annotation.
annotationThe annotation being rendered.
Return Value
A color to use for the shape outline.
-
Returns the fill color to use when rendering a polygon annotation. Defaults to the map view’s tint color.
Declaration
Objective-C
- (nonnull UIColor *)mapView:(nonnull VBDMapView *)mapView fillColorForPolygonAnnotation:(nonnull VBDPolygon *)annotation;Parameters
mapViewThe map view rendering the polygon annotation.
annotationThe annotation being rendered.
Return Value
A color to use for the polygon interior.
-
Returns the line width to use when rendering a polyline annotation. Defaults to
3.0.Declaration
Objective-C
- (CGFloat)mapView:(nonnull VBDMapView *)mapView lineWidthForPolylineAnnotation:(nonnull VBDPolyline *)annotation;Parameters
mapViewThe map view rendering the polygon annotation.
annotationThe annotation being rendered.
Return Value
A line width for the polyline.
-
Returns a Boolean value indicating whether the annotation is able to display extra information in a callout bubble.
If the value returned is
YES, a standard callout bubble is shown when the user taps a selected annotation. The callout uses the title and subtitle text from the associated annotation object. If there is no title text, though, the annotation will not show a callout. The callout also displays any custom callout views returned by the delegate for the left and right callout accessory views.If the value returned is
NO, the value of the title and subtitle strings are ignored.Declaration
Objective-C
- (BOOL)mapView:(nonnull VBDMapView *)mapView annotationCanShowCallout:(nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view that requested the annotation callout ability.
annotationThe object representing the annotation.
Return Value
A Boolean indicating whether the annotation should show a callout.
-
Returns a callout view to display for the specified annotation.
If this method is present in the delegate, it must return a new instance of a view dedicated to display the callout bubble. It will be configured by the map view. If this method is not present, or if it returns
nil, a standard, two-line, bubble-like callout view is displayed by default.Declaration
Objective-C
- (nullable UIView<VBDCalloutView> *)mapView:(nonnull VBDMapView *)mapView calloutViewForAnnotation: (nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view that requested the callout view.
annotationThe object representing the annotation.
Return Value
A view conforming to the
VBDCalloutViewprotocol, ornilto use the default callout view. -
Returns the view to display on the left side of the standard callout bubble.
The default value is treated as if
nil. The left callout view is typically used to display information about the annotation or to link to custom information provided by your application.If the view you specify is also a descendant of the
UIControlclass, you can use the map view’s delegate to receive notifications when your control is tapped. If it does not descend fromUIControl, your view is responsible for handling any touch events within its bounds.Declaration
Objective-C
- (nullable UIView *)mapView:(nonnull VBDMapView *)mapView leftCalloutAccessoryViewForAnnotation:(nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view presenting the annotation callout.
annotationThe object representing the annotation with the callout.
Return Value
The accessory view to display.
-
Returns the view to display on the right side of the standard callout bubble.
The default value is treated is if
nil. The right callout view is typically used to link to more detailed information about the annotation. A common view to specify for this property isUIButtonobject whose type is set toUIButtonTypeDetailDisclosure.If the view you specify is also a descendant of the
UIControlclass, you can use the map view’s delegate to receive notifications when your control is tapped. If it does not descend fromUIControl, your view is responsible for handling any touch events within its bounds.Declaration
Objective-C
- (nullable UIView *)mapView:(nonnull VBDMapView *)mapView rightCalloutAccessoryViewForAnnotation: (nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view presenting the annotation callout.
annotationThe object representing the annotation with the callout.
Return Value
The accessory view to display.
-
Tells the delegate that the user tapped one of the annotation’s accessory buttons.
Accessory views contain custom content and are positioned on either side of the annotation title text. If a view you specify is a descendant of the
UIControlclass, the map view calls this method as a convenience whenever the user taps your view. You can use this method to respond to taps and perform any actions associated with that control. For example, if your control displayed additional information about the annotation, you could use this method to present a modal panel with that information.If your custom accessory views are not descendants of the
UIControlclass, the map view does not call this method.Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView annotation:(nonnull id<VBDAnnotation>)annotation calloutAccessoryControlTapped:(nonnull UIControl *)control;Parameters
mapViewThe map view containing the specified annotation.
annotationThe annotation whose button was tapped.
controlThe control that was tapped.
-
Tells the delegate that the user tapped on an annotation’s callout view.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView tapOnCalloutForAnnotation:(nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view containing the specified annotation.
annotationThe annotation whose callout was tapped.
-
Tells the delegate that one of its annotations was selected.
You can use this method to track changes in the selection state of annotations.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView didSelectAnnotation:(nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view containing the annotation.
annotationThe annotation that was selected.
-
Tells the delegate that one of its annotations was deselected.
You can use this method to track changes in the selection state of annotations.
Declaration
Objective-C
- (void)mapView:(nonnull VBDMapView *)mapView didDeselectAnnotation:(nonnull id<VBDAnnotation>)annotation;Parameters
mapViewThe map view containing the annotation.
annotationThe annotation that was deselected.
VBDMapViewDelegate Protocol Reference