在观看WWDC视频206后,我认为将详细的标注视图添加到mapView注释视图是一项微不足道的任务.
所以,我认为我做错了什么.
设置了引脚视图
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let view:MKAnnotationView!
if let dequed = routeMapView.dequeueReusableAnnotationViewWithIdentifier("pin") {
view = dequed
}
else {
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin")
}
let x = UIView(frame: CGRectMake(0, 0, 200, 200))
x.backgroundColor = UIColor.redColor()
// shows the red
//view.leftCalloutAccessoryView = x
// working as no subtitle - but no red view
view.detailCalloutAccessoryView = x
view.canShowCallout = true
return view
}
Run Code Online (Sandbox Code Playgroud)
我只能得到这个
我知道这个观点正在发挥作用,因为如果我试着用它leftCalloutAccessoryView来做

我肯定错过了什么.请注意,如果我只是添加图像detailCalloutAccessoryView等
view.detailCalloutAccessoryView …Run Code Online (Sandbox Code Playgroud)