Platforms to show: All Mac Windows Linux Cross-Platform

Back to MKMapViewMBS class.

Previous items

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
dim 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.

MKMapViewMBS.viewForAnnotation(annotation as MKAnnotationMBS) as MKAnnotationViewMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MapKit MBS MacFrameworks Plugin 19.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the annotation view associated with the specified annotation object, if any.
Example
Function viewForAnnotation(mapView as MKMapViewMBS, annotation as MKAnnotationMBS) Handles viewForAnnotation as MKAnnotationViewMBS
// return nil for default annotation view

// new annotation view
Dim v As New MKAnnotationViewMBS(annotation)

// get a picture and use it as decoration
Dim pic As Picture = LogoMBS(100)
Dim img As New NSImageMBS(pic)
img.setSize(pic.Width/2, pic.Height/2) // half size gives 2x resolution, if the picture isn't retina aware

// set image and return
v.image = img

Return v
End Function

annotation: The annotation object whose view you want.

Returns the annotation view or nil if the view has not yet been created. This method may also return nil if the annotation is not in the visible map region and therefore does not have an associated annotation view.

Previous items

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


The biggest plugin in space...