由于某些原因,自从我更新到iOS 11后,我的callout Accessory
并未显示我的注释。我根据我从服务器查询的数据设置了标题和副标题,但是我无法获得标注附件以及要显示的.detailedDisclosure
。
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
print("viewForannotation")
if annotation is MKUserLocation {
//return nil
return nil
}
// guard let annotation = annotation as? CalloutPin else { return nil }
let reuseId = "pin"
var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId) as? MKPinAnnotationView
if pinView == nil {
//print("Pinview was nil")
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
pinView!.canShowCallout = true
pinView!.animatesDrop = true
}
let button = UIButton(type: UIButtonType.detailDisclosure) as UIButton // button with info sign in it
pinView!.canShowCallout = true
pinView!.rightCalloutAccessoryView = button
// pinView?.detailCalloutAccessoryView = button
return pinView
}
有人有解决方案吗?任何帮助都会非常感激,因为我现在已经处理了这个问题很长一段时间,因为我需要显示标注附件,以便在选择注释引脚时让我转向另一个视图控制器。谢谢!
此处显示的内容:MapView Annotation