iOS distinguish between which callout accessory is tapped

后端 未结 1 1454
深忆病人
深忆病人 2021-01-13 02:52

In my map annotations, I have a UIButton as each accessory view in the callouts. In the - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view ca

相关标签:
1条回答
  • 2021-01-13 03:15

    Rather than setting and using tags, you could just check if control is the left or right accessory view:

    if (control == view.leftCalloutAccessoryView) {
        //handle left control tap...        
    }
    else
    if (control == view.rightCalloutAccessoryView) {
        //handle right control tap...       
    }
    
    0 讨论(0)
提交回复
热议问题