5

I think the title is quite self explanatory. Currently when I add a default annotation for current location:

let currentAnnot = MKPointAnnotation()
currentAnnot.coordinate = loc.coordinate
mainMap.addAnnotation(currentAnnot)

It is giving me a red pin. I want the same blue dot with light blue field which the Apple iPhone Maps app is using by default. Is there a special name for that and how can I add it?

Gabriel Jensen
  • 4,082
  • 1
  • 17
  • 14
Kashif
  • 4,642
  • 7
  • 44
  • 97
  • I think you are looking for https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKPinAnnotationView_Class/index.html#//apple_ref/occ/instp/MKPinAnnotationView/pinColor but it is deprecated maybe this answer http://stackoverflow.com/a/32815402/2303865 – Leo Dabus Oct 19 '15 at 21:25
  • Do you mean `MKUserLocation`? You do not create instances of this class directly. If you want to add blue dot on Map, you need to use blue dot image file. – Kosuke Ogawa Oct 20 '15 at 02:09

1 Answers1

7

It's because you're adding an annotation (pin) rather than the user location.

Enable it by using the following

mapView.showsUserLocation = true

Also check out a tutorial which may help

Russell
  • 3,099
  • 2
  • 14
  • 18
  • Thank you. Even though this code kept throwing "MKMapView does have a member showUserLocation", I found there was actually a checkbox to that effect in IB! – Kashif Oct 20 '15 at 12:18