iosmapkitmkannotationcallouts

How to make MKAnnotationView more sensitive in the MapKit?


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.


Solution

  • 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.