How to show blue pin with dot (circle) in MKMapView in IPhone
This is one of properties of MKMapView class. Default value is No, so just set it to YES in your code.
Note that if you add a MapView on to your ViewController in Storyboard, look at the attribute inspector, by default has other annotations checked (Buildings, Points of Interest) on your MapView excepts User Location. It took me a while to find this, it feels like I am playing hide and seek, no sure why it so important to leave this unchecked.
self.mapView.showsUserLocation = YES;
As thexande mentioned, for swift3 you will have to set this to true:
self.mapView.showsUserLocation = true;
Add this to the top of the viewForAnnotation method:
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
The special user location annotation is of type MKUserLocation and returning nil in that case tells the map view to draw the default view for it which is the blue dot. and go in MKMapview property and check the show user location....
For SWIFT 3
if (annotation.isKind(of: MKUserLocation.self)){
return nil
}
This will allow you to show a blue dot for your user's location in swift 3.
Put this code in the mapView viewFor annotation func