Platforms to show: All Mac Windows Linux Cross-Platform

Back to MKMapViewMBS class.

MKMapViewMBS.selectAnnotation(annotation as MKAnnotationMBS, 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
Selects the specified annotation and displays a callout view for it.

annotation: The annotation object to select.
animated: If true, the callout view is animated into position.

If the specified annotation is not onscreen, and therefore does not have an associated annotation view, this method has no effect.

MKMapViewMBS.selectedAnnotations as MKAnnotationMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The annotations that are currently selected.

Assigning a new array to this property selects only the first annotation in the array.

MKMapViewMBS.setCamera(camera as MKMapCameraMBS, Animated as boolean = true)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Changes the camera used for determining the map’s viewing parameters and optionally animates the change.

camera: The camera object containing the viewing angle information. This parameter must not be nil.
animated: Specify true if you want the change in viewing angle to be animated or false if you want the map to reflect the changes without animations.

MKMapViewMBS.setCenterCoordinate(centerCoordinate as CLLocationCoordinate2DMBS, zoomLevel as double, animated as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.5 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
hanges the center coordinate of the map with zoom and optionally animates the change.

Zoomlevel is in range 1 to 20.

Latitude and Longitude in coordinate: The new center coordinate for the map.
animated: Specify true if you want the map view to scroll to the new location or false if you want the map to display the new location immediately.

Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. It also updates the value in the region property to reflect the new center coordinate and the new span values needed to maintain the current zoom level.

See also:

Some examples using this method:

MKMapViewMBS.setCenterCoordinate(coordinate as CLLocationCoordinate2DMBS, Animated as boolean = true)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Changes the center coordinate of the map and optionally animates the change.

Latitude and Longitude in coordinate: The new center coordinate for the map.
animated: Specify true if you want the map view to scroll to the new location or false if you want the map to display the new location immediately.

Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. It also updates the value in the region property to reflect the new center coordinate and the new span values needed to maintain the current zoom level.

See also:

MKMapViewMBS.setRegion(c as CLLocationCoordinate2DMBS, animated as boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Changes the currently visible region and optionally animates the change.

Same as SetRegion with MKCoordinateRegionMBS but reuses current coordinate span.

See also:

MKMapViewMBS.setRegion(region as MKCoordinateRegionMBS, animated as boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Changes the currently visible region and optionally animates the change.
Example
Var mapview as MKMapViewMBS // your mapview

// get current region
Var r as MKCoordinateRegionMBS = mapview.region

// make new span with double deltas
Var s as new MKCoordinateSpanMBS(r.span.latitudeDelta*2, r.span.longitudeDelta*2)

// make new region
Var n as new MKCoordinateRegionMBS(r.center, s)

// and zoom there
mapview.setRegion n, true

region: The new region to display in the map view.
animated: Specify true if you want the map view to animate the transition to the new region or false if you want the map to center on the specified region immediately.

Changing just the center coordinate of the region can still cause the span values to change implicitly. The span values might change because that the distances represented by a span change at different latitudes and longitudes and the map view may need to adjust the span to account for the new location. If you want to change the center coordinate without changing the zoom level, use the setCenterCoordinate instead.

When setting a new region, the map may adjust the value in the region parameter so that it fits the visible area of the map precisely. This adjustment is normal and is done to ensure that the value in the region property always reflects the visible portion of the map. However, it does mean that if you get the value of that property right after calling this method, the returned value may not match the value you set. (You can use the regionThatFits method to determine the region that will actually be set by the map.)

See also:

MKMapViewMBS.setVisibleMapRect(coordinate as MKMapRectMBS, Animated as boolean = true)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Changes the currently visible portion of the map and optionally animates the change.

mapRect: The map rectangle to make visible in the map view.
animate: Specify true if you want the map view to animate the transition to the new map rectangle or false if you want the map to center on the specified rectangle immediately.

See also:

MKMapViewMBS.setVisibleMapRect(mapRect as MKMapRectMBS, edgePaddingLeft as Double, edgePaddingTop as Double, edgePaddingRight as Double, edgePaddingBottom as Double, 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
Changes the currently visible portion of the map, allowing you to specify additional space around the edges.

MapRect: The map rectangle to make visible in the map view.
edgePaddingLeft, edgePaddingTop, edgePaddingRight and edgePaddingBottom: The amount of additional space (measured in screen points) to make visible around the specified rectangle.
animate: Specify true if you want the map view to animate the transition to the new map rectangle or false if you want the map to center on the specified rectangle immediately.

See also:

MKMapViewMBS.setZoomLevel(zoomLevel as double, animated as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.5 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets zoom level.

Zoomlevel is in range 1 to 20.

MKMapViewMBS.showAddress(address as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 14.1 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Convenience method to run an address geocoding and shows position on map.
Example
Var mapview as MKMapViewMBS // your map view
mapView.showAddress "Markt 15, Andernach, Deutschland"

Uses CLGeocoderMBS geocodeAddressString method to asynchronously find the place and show it on the map.

Some examples using this method:

MKMapViewMBS.ShowAllAnnotations(withOverlays as boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 22.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Zooms map to show all annotations.

The plugin loops over the annotations to calculate a bounding rectangle for all annotations and zoom the map to make them all visible with some border space around.

Added withOverlays parameter in v22.4 to include overlays in the calculation of the rectangle.

MKMapViewMBS.showAnnotations(annotations() as MKAnnotationMBS, 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 visible region so that the map displays the specified annotations.

annotations: The annotations that you want to be visible in the map.
animated: true if you want the map region change to be animated, or NO if you want the map to display the new region immediately without animations.

Calling this method updates the value in the region property and potentially other properties to reflect the new map region.

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


The biggest plugin in space...