Platforms to show: All Mac Windows Linux Cross-Platform

Back to MKAnnotationViewMBS class.

MKAnnotationViewMBS.Constructor(annotation as MKAnnotationMBS, reuseIdentifier as string = "", EnableEvents as Boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Initializes and returns a new annotation view.

annotation: The annotation object to associate with the new view.
reuseIdentifier: If you plan to reuse the annotation view for similar types of annotations, pass a string to identify it. Although you can pass nil if you do not intend to reuse the view, reusing annotation views is generally recommended.

Returns the initialized annotation view or nil if there was a problem initializing the object.

The reuse identifier provides a way for you to improve performance by recycling annotation views as they are scrolled on and off of the map. As views are no longer needed, they are moved to a reuse queue by the map view. When a new annotation becomes visible, your application can request a view for that annotation by passing the appropriate reuse identifier string to the dequeueReusableAnnotationViewWithIdentifier: method of MKMapView.

Added EnableEvents parameter to enable new prepareForDisplay and prepareForReuse events. But please keep reference in some global array to those objects to keep the events working.

See also:

MKAnnotationViewMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 21.3 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Constructor for creating an instanced based on an existing handle.

Useful if you get a MKAnnotationView reference from a declare.
The object is retained.

See also:

MKAnnotationViewMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 20.4 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The destructor.

MKAnnotationViewMBS.setDragState(State as Integer, animated as Boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the current drag state for the annotation view.

newDragState: The new drag state for the annotation view.
animated: If true, the change to the new drag state should be animated; otherwise, it should be made without animations.

Applications targeting iOS 4.2 and later can override this method and use it to implement drag support for custom annotation views. As the system detects user actions that would indicate a drag, it calls this method to update the drag state. In response to these changes, your custom implementation of this method should do the following:
When the drag state changes to MKAnnotationViewDragStateStarting, set the state to MKAnnotationViewDragStateDragging. If you perform an animation to indicate the beginning of a drag, and the animated parameter is true, perform that animation before changing the state.

When the state changes to either MKAnnotationViewDragStateCanceling or MKAnnotationViewDragStateEnding, set the state to MKAnnotationViewDragStateNone. If you perform an animation at the end of a drag, and the animated parameter is true, you should perform that animation before changing the state.

The default implementation of this method sets the value of the dragState property to the value in the newDragState parameter only. Therefore, direct subclasses can simply call the inherited version of this method to change the drag state; otherwise, just change the value in the draggable property directly.

Changing the state to MKAnnotationViewDragStateDragging or MKAnnotationViewDragStateNone is the way to signal to the map view that you are done with any animations you wanted to perform. For example, when a drag operation begins for a pin annotation, the MKPinAnnotationView class executes an animation to lift the pin off the map. Similarly, when the pin is dropped, the class performs a drop animation. Even if you do not perform any animations, you should call the inherited version of this method to update the dragState property.

You must not try to abort a new drag operation by changing the state from MKAnnotationViewDragStateStarting to MKAnnotationViewDragStateNone. If you do not want your annotation view to be draggable, set the draggable property to NO.

MKAnnotationViewMBS.setSelected(selected as boolean, animated as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the selection state of the annotation view.

selected: Contains the value true if the view should display itself as selected.
animated: Set to true if the change in selection state is animated.

You should not call this method directly. An MKMapView object calls this method in response to user interactions with the annotation.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...