objective-cmkmapviewmkannotationmkpinannotationviewviewdidappear

iOS 6 maps- not animating PIN drop


I have created a custom MKAnnotation class and it has been working - until iOS 6 came out. Since then my pins get added to the apple map but now without a drop animation! Is this how it is set or there maybe an an issue with the way I'm doing things. I have set a delay of 1 sec until the method that adds the annotations to the map is called, so I can see if the drop animations are actually occurring before the view appears - still, the pins just appear out of nowhere without dropping. Here's the code I'm using:

-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(Annotation*)annotation
{
    NSLog(@"the annotation ID is: %@", annotation.ID);
    MKPinAnnotationView *MyPin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation   reuseIdentifier:@"current"];

    UIButton *goToObjectButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

    [goToObjectButton addTarget:self action:@selector(goToObjectClick:)  forControlEvents:UIControlEventTouchUpInside];


    MyPin.pinColor = MKPinAnnotationColorRed;
    MyPin.rightCalloutAccessoryView = goToObjectButton;
    MyPin.draggable = NO;
    MyPin.highlighted = YES;
    MyPin.animatesDrop=YES;
    MyPin.canShowCallout = YES;

    return MyPin;
}

Solution

  • It appears that with the new Apple MapKit in iOS 6, the sequence of when annotations are added onto a MKMapView has changed a bit.

    (In my own case, I used to add annotations, then set the delegate of the map view immediately after, and before iOS 6, the annotations didn't appear until later in the run cycle, but now they try to add immediately.)

    So, it may be an issue that either the annotations are being added before the delegate is hooked up, or that you're adding the annotations too early and just not seeing the animation. More code samples regarding when the MKMapView is being created (assuming you're doing it in code, and not in a .xib) and when you're adding your annotations might help clarify what's wrong.