Questions tagged [mapkit]

MapKit is Apple's framework for presenting and annotating scrollable and zoom-enabled maps on iOS, IPadOS, tvOS, watchOS, and macOS.

MapKit is Apple's framework for presenting and annotating maps for iOS, IPadOS, tvOS, watchOS, and macOS. Maps are rendered via the MKMapView control, which offers scrolling, zooming, and optionally real-time highlighting of the user's current location on both traditional maps as well as satellite imagery.

Maps can be further customized by:

  • Adding annotations (information about a point on the map), which can then be represented on the MKMapView using annotation views, graphical representations (such as a drop pin or a custom image). Annotations also may have associated attributes (such as text that can appear in a callout box that appears when you tap on an annotation view), and these callout boxes can also have additional behaviors (e.g. left and right accessory controls that you can use to perform custom operations, etc);

  • Adding overlays, graphical representations between a collection of map points (e.g. a MKPolyline that represents one or more line segments, such as a path, along the map; a MKPolygon that represents a shaded portion of the map defined by the coordinates of a polygon, a MKCircle that represents a shaded circle around a particular map point, etc.). Overlays are represented by MKOverlayView objects which define the particulars of how the overlay is represented (line thickness, line color, shading, etc.).

  • The Map Kit framework also provides local search capabilities (as of iOS 6.1, OS X 10.9), via MKLocalSearch, which will asynchronously return establishments and points of interest based upon the search criteria.

The reverse geocoding, via MKReverseGeocoder, is deprecated as of iOS 5.0, superseded by the CLGeocoder class of the Core Location framework

MapKit is part of the following SDKs:

  • iOS 3.0 and later,
  • macOS 10.9 and later,
  • Mac Catalyst 13.0 and later,
  • tvOS 9.2 and later,
  • watchOS 2.0 and later.

Related tags:

References:

5649 questions
359
votes
10 answers

How to pass prepareForSegue: an object

I have many annotations in a mapview (with rightCalloutAccessory buttons). The button will perform a segue from this mapview to a tableview. I want to pass the tableview a different object (that holds data) depending on which callout button was…
chizzle
  • 4,122
  • 5
  • 15
  • 18
225
votes
8 answers

How can I mimic the bottom sheet from the Maps app?

Can anyone tell me how I can mimic the bottom sheet in the new Maps app in iOS 10? In Android, you can use a BottomSheet which mimics this behaviour, but I could not find anything like that for iOS. Is that a simple scroll view with a content…
qwertz
  • 5,684
  • 9
  • 35
  • 60
159
votes
12 answers

Programmatically open Maps app in iOS 6

Previous to iOS 6, opening a URL like this would open the (Google) Maps app: NSURL *url = [NSURL URLWithString:@"http://maps.google.com/?q=New+York"]; [[UIApplication sharedApplication] openURL:url]; Now with the new Apple Maps implementation, this…
Tom Hamming
  • 9,484
  • 9
  • 66
  • 131
121
votes
15 answers

Setting the zoom level for a MKMapView

I have a map which shows correctly, the only thing I want to do now is set the zoom level when it loads. Is there a way to do this? Thanks
some_id
  • 28,294
  • 58
  • 173
  • 293
94
votes
24 answers

Positioning MKMapView to show multiple annotations at once

I've got several annotations I want to add to my MKMapView (it could 0-n items, where n is generally around 5). I can add the annotations fine, but I want to resize the map to fit all annotations onscreen at once, and I'm not sure how to do…
jbrennan
  • 11,523
  • 14
  • 69
  • 110
88
votes
9 answers

How to customize the callout bubble for MKAnnotationView?

I'm currently working with the mapkit and am stuck. I have a custom annotation view I am using, and I want to use the image property to display the point on the map with my own icon. I have this working fine. But what I would also like to do is to…
Zach
  • 1,174
  • 2
  • 10
  • 14
85
votes
5 answers

MKMapView Zoom and Region

I'm familiar with using Google Maps Javascript API. Recently I started using MapKit framework for an iphone project, but I'm having a hard time to figure out zooming and setting a region on map. In Google Maps API I used to use integer zoom levels…
cocoatoucher
  • 1,463
  • 3
  • 17
  • 22
54
votes
10 answers

Drawing a route in MapKit in iOS

I want to draw a route between two locations on the map. Something like a tour guide. When the tourist clicks another location, I want to be able to draw a route; as well as, inform about the distance from the current location. I am aware of sites…
PRN
  • 565
  • 1
  • 5
  • 9
53
votes
2 answers

VectorKit crash reports with MKMapSnapshotter on iOS

I'm getting different kind of crash reports related to VectorKit and MKMapSnapShotter. Crashes occur pretty random, but it seems like they happen most when returning from the background. The device does not send out any memory warnings before it…
Jorn van Dijk
  • 1,973
  • 1
  • 14
  • 23
51
votes
8 answers

iOS 8 Map Kit Obj-C Cannot Get Users Location

I am working with Map Kit in iOS 8 using Obj-C NOT SWIFT. I cannot get the device location it is set a 0.00, 0.00 and I am getting the error: Trying to start MapKit location updates without prompting for location authorization. Must call…
MBarton
  • 2,057
  • 2
  • 12
  • 17
50
votes
9 answers

Convert coordinates to City name?

How to get an address from coordinates using MapKit? I have this code when long press on the map it gets the coordinates: func didLongPressMap(sender: UILongPressGestureRecognizer) { if sender.state == UIGestureRecognizerState.Began { …
Tevfik Xung
  • 888
  • 2
  • 9
  • 18
47
votes
1 answer

MapKit poor scrolling performance with Apple Maps in iOS 6

I am writing an app which displays a simple Apple Map across most of the screen. However, when I compare the speed of scrolling, there is a significant slow-down comparative to the native Apple Maps which come with iOS 6. In my investigation of why,…
Moshe Marciano
  • 2,309
  • 3
  • 32
  • 43
46
votes
3 answers

MKMapView MKPointAnnotation tap event

I have a list of annotations (MKPointAnnotation). I have a UIViewController which is for the whole view, MKMapView implementing Controller, which I thought is useful for detecting the users interaction with the map, my own MKPointAnnotation…
Ravi Vooda
  • 5,016
  • 5
  • 17
  • 25
41
votes
3 answers

Snapshot of MKMapView in iOS7

I am trying to create a snapshot of a MKMapView in iOS7 application the same way it's recommended everywhere for previous iOS versions: - (UIImage*) renderMapViewToImage { UIGraphicsBeginImageContextWithOptions(mapView.frame.size, NO, 0.0); …
Michael
  • 583
  • 2
  • 6
  • 8
39
votes
9 answers

MKPinAnnotationView: Are there more than three colors available?

According to the Apple docs, MKPinAnnotationView's pin color is available in red, green and purple. Is there any way to get other colors also? I've found nothing in the docs.
Stefan
  • 28,004
  • 14
  • 62
  • 76
1
2 3
99 100