• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why Annotations callout sometimes not work ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: rerunning an NSOperation object
  • Next by Date: Invitation to connect on LinkedIn
  • Previous by thread: Re: rerunning an NSOperation object
  • Next by thread: Invitation to connect on LinkedIn
  • Index(es):
    • Date
    • Thread