Why Annotations callout sometimes not work ?
Why Annotations callout sometimes not work ?
- Subject: Why Annotations callout sometimes not work ?
- From: zhixiong ye <email@hidden>
- Date: Sun, 06 Mar 2011 09:58:00 +0800
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 (email@hidden)
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:
This email sent to email@hidden