MapKit.MKMapView Class
Embeddable Map View.

See Also: MKMapView Members

Syntax

[Foundation.Register("MKMapView", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.Mac_10_0 | ObjCRuntime.Platform.Mac_10_1 | ObjCRuntime.Platform.Mac_10_2 | ObjCRuntime.Platform.Mac_10_3 | ObjCRuntime.Platform.Mac_10_4 | ObjCRuntime.Platform.Mac_10_5 | ObjCRuntime.Platform.Mac_10_6 | ObjCRuntime.Platform.Mac_10_7 | ObjCRuntime.Platform.Mac_10_8 | ObjCRuntime.Platform.Mac_10_9 | ObjCRuntime.Platform.Mac_10_10 | ObjCRuntime.Platform.Mac_Version | ObjCRuntime.Platform.Mac_Arch64 | ObjCRuntime.Platform.Mac_Arch)]
public class MKMapView : UIKit.UIView

Remarks

The MapKit.MKMapView provides a zoomable map interface upon which the application developer can add information-bearing MapKit.MKAnnotations and area-based MapKit.MKOverlays.

In iOS 7 and later, maps support 3D imagery when the MKMapView.MapType property is MKMapType.Standard. To view 3D imagery, the MKMapView.ShowsBuilding property must be true and the MKMapView.Camera and and MKMapView.PitchEnabled properties must be set to create a non-vertical perspective. The iOS simulator does not render 3D buildings. The following example shows how a camera can be set to provide 3D imagery:

C# Example

var target = new CLLocationCoordinate2D(37.7952, -122.4028);
var viewPoint = new CLLocationCoordinate2D(37.8009, -122.4100);
//Enable 3D buildings
mapView.ShowsBuildings = true;
mapView.PitchEnabled = true;

var camera = MKMapCamera.CameraLookingAtCenterCoordinate(target, viewPoint, 500);
mapView.Camera = camera;
          

Overlays

iOS distinguishes between the MapKit.MKOverlay, which represents the geometry of an overlay, and it's visual presentation. Prior to iOS 7, overlays were rendered using MapKit.MKOverlayViews. In iOS 7, these classes have been deprecated, and overlays now use the more efficient subclasses of MapKit.MKOverlayRenderer.

To create an overlay and its renderer, application developers must add the overlay to the MapKit.MKMapView and return the renderer either using the MKMapView.OverlayRenderer property or by overriding the MKMapViewDelegate.OverlayRenderer method.

C# Example

MKPolygon hotelOverlay = MKPolygon.FromCoordinates(coordinates);
mkMap.AddOverlay (hotelOverlay);
var polygon = MKPolygon.FromCoordinates(coordinates);
var renderer = new MKPolygonRenderer(polygon) { FillColor = UIColor.Red, Alpha = 0.5f };
mkMap.OverlayRenderer = (view, overlay) => renderer;
          

Related content

Requirements

Namespace: MapKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0