【发布时间】:2017-02-14 06:37:21
【问题描述】:
此代码用于初始化注释的视图,但右侧的辅助视图在地图中不可见。
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
var view = mapView.dequeueReusableAnnotationView(withIdentifier: "Map")
if view == nil {
view = MKAnnotationView(annotation: annotation, reuseIdentifier: "Map")
view?.canShowCallout = true
let btn = UIButton(type: .detailDisclosure)
view?.rightCalloutAccessoryView = btn
}
view?.annotation = annotation
return view
}
我不知道是什么问题。
【问题讨论】:
-
您正在使用
rightCalloutAccessoryView并要求左转 -
感谢您的指出。 @SachinVas
-
@RohitDulam
CalloutAccessoryView是在您tap/select之前显示的注释。 -
是的,但是在我触摸左侧附件视图后也没有显示它。 @NiravD
-
@RohitDulam 您需要开始接受有助于您从不接受任何答案的答案。请查看stackoverflow.com/help/someone-answers 和meta.stackexchange.com/questions/5234...。这将为您和帖子的作者增加声誉。
标签: ios swift apple-maps