我可以使用以下代码在 map 注释上显示公开图标。
annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: annotationIdentifier)
annotationView?.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
当您按下公开图标时,它会闪烁,但没有其他 react 。我尝试在其上放置一个按钮处理程序,但它不是一个按钮,所以编译器说不。我是否必须创建一个完整的手势识别器才能让它执行任何操作,或者如何按下指示器来显示有关位置的信息?
最佳答案
您需要这个委托(delegate)方法
func mapView(_ mapView: MKMapView,
annotationView view: MKAnnotationView,
calloutAccessoryControlTapped control: UIControl)
与
self.mapView.delegate = self
关于ios - 在 Swift 中显示 MKAnnotationView 的公开指示器标注,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53307647/