Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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

imageView.center = annotationView.center;

try

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top