Domanda

I have a custom MKAnnotationView appear with a UIImageView by the size 16*16, and when user tap on it, I use the protocol

 - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    [mapView setCenterCoordinate:view.annotation.coordinate];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [calloutView setHidden:!selected];
}

to pop up a customized calloutView . It can works OK. But sometime it may take two or three times or even more to make the annotation sensitive and invoke the method to show the calloutView. Is there anyone have faced this issue and there is some solution to solve it.

È stato utile?

Soluzione

I have solved it. We must give the customized MKAnnotationView a image and the User Interaction bound is the image's CGSize. So I made a transparent image and assign it to the MKAnnotationView's image property.

self.image=[UIImage imageNamed:@"transparent36.png"];

it works very well.

Altri suggerimenti

You should tapp at the center of the MKAnnotationView, and also try adding the

imageView.center = annotationView.center;

try

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top