How do I animate MKAnnotationView drop?

One problem with the code above by Anna Karenina is that it doesn’t deal with when you add annotations below where the user is looking at the moment. Those annotations will float in mid-air before dropping because they are moved into the user’s visible map rect. Another is that it also drops the user location … Read more

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

iOS 8 MKAnnotationView rightCalloutAccessoryView misaligned

I solved this by setting the autoresizingmask to fix the vertical bug and frame.size.width for the horizontal bug UIButton* infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [infoButton setFrame:CGRectMake(0, 0, CGRectGetWidth(infoButton.frame)+10, CGRectGetHeight(infoButton.frame))]; [infoButton setAutoresizingMask:UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleTopMargin]; [annotationView setRightCalloutAccessoryView:infoButton];

MKAnnotation image offset with custom pin image

Your UIAnnotationView is always drawn at the same scale, the map’s zoom level doesn’t matter. That’s why centerOffset isn’t bound with the zoom level. annView.centerOffset is what you need. If you see that your pin is not at the good location (for example, the bottom center move a little when you change the zoom level), … Read more

Draw a circle of 1000m radius around users location in MKMapView

Try a custom overlay. Add this in viewDidLoad: MKCircle *circle = [MKCircle circleWithCenterCoordinate:userLocation.coordinate radius:1000]; [map addOverlay:circle]; userLocation can be obtained by storing the MKUserLocationAnnotation as a property. Then, to actually draw the circle, put this in the map view’s delegate: – (MKOverlayRenderer *)mapView:(MKMapView *)map viewForOverlay:(id <MKOverlay>)overlay { MKCircleRenderer *circleView = [[MKCircleRenderer alloc] initWithOverlay:overlay]; circleView.strokeColor = … Read more

How to customize the callout bubble for MKAnnotationView?

There is an even easier solution. Create a custom UIView (for your callout). Then create a subclass of MKAnnotationView and override setSelected as follows: – (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; if(selected) { //Add your custom view to self… } else { //Remove your custom view… } } Boom, job done.

tech