MapKit not showing custom Annotation pin image on iOS9

Instead of creating an MKPinAnnotationView, create a plain MKAnnotationView. The MKPinAnnotationView subclass tends to ignore the image property since it’s designed to show the standard red, green, purple pins only (via the pinColor property). When you switch to MKAnnotationView, you’ll have to comment out the animatesDrop line as well since that property is specific to … Read more

How do I remove all annotations from MKMapView except the user location annotation?

Update: When I tried with the iOS 9 SDK the user annotation is no longer removed. You can simply use mapView.removeAnnotations(mapView.annotations) Historical answer (for apps that run on iOS before iOS 9): Try this: NSMutableArray * annotationsToRemove = [ mapView.annotations mutableCopy ] ; [ annotationsToRemove removeObject:mapView.userLocation ] ; [ mapView removeAnnotations:annotationsToRemove ] ; EDIT: Swift … Read more

MKMapView: Instead of Annotation Pin, a custom view

When you want to use your own image for an annotation view, you should create an MKAnnotationView instead of an MKPinAnnotationView. MKPinAnnotationView is a subclass of MKAnnotationView so it has an image property but it generally overrides that and draws a pin image (that’s what it’s for). So change the code to: -(MKAnnotationView *)mapView:(MKMapView *)mV … Read more

tech