开发者

MKMap annotation selection

开发者 https://www.devze.com 2023-04-04 08:19 出处:网络
I want 开发者_如何学Pythonto check when he user presses the annotation (the bubble on top of the pin). I tried the following :

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

精彩评论

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

关注公众号