I add a NSArray of Annotations in a mapview, she the canshowcallout=yes,but 
sometimes some of the annotations don't show callout, tap it more maybe work, 
what's the problem?

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView 
*)view {
Event *aEvent = nil;
UIImageView *imageView = nil;


if ([view.annotation isKindOfClass:[Event class]]) {
    aEvent = (Event *)view.annotation;
    MKCoordinateRegion currentRegion;
    currentRegion.center = aEvent.coordinate;
    currentRegion.span.latitudeDelta = 0.005;
    currentRegion.span.longitudeDelta = 0.005;

    [self.mapView setRegion:currentRegion animated:YES];

}
if ([view.leftCalloutAccessoryView isKindOfClass:[UIImageView class]]) {
    imageView = (UIImageView *) view.leftCalloutAccessoryView;
}

if (aEvent && imageView) {
    imageView.image = [UIImage imageWithData:aEvent.image];

}


NSLog(@"title is %@",view.annotation.title);
NSLog(@"image is %@",imageView.image);
}


i found that problem is caused by adding these code

        MKCoordinateRegion currentRegion;
    currentRegion.center = aEvent.coordinate;
    currentRegion.span.latitudeDelta = 0.005;
    currentRegion.span.longitudeDelta = 0.005;

    [self.mapView setRegion:currentRegion animated:YES];
but why?_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to