开发者

MKMap annotation selection

I want 开发者_如何学Pythonto check when he user presses the annotation (the bubble on top of the pin). I tried the following :

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{}

but it fires up when i press the pin. How can i check when the user actually presses on the annotation bubble?


You can first put a right accessory button and set an separate action for it as such:

            UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [rightButton addTarget:self
                        action:@selector(showDetails:)
              forControlEvents:UIControlEventTouchUpInside];

        customPinView.rightCalloutAccessoryView = rightButton;

you can implement the showDetails method with the function that you like

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜