After watching WWDC video 206 I assumed this would be a trivial task of adding the detail callout view to a mapView annotation view.
So, I assume Im doing something wrong.
With my pin view set up
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
}
I only get this
I know the view is working, because if I try it with the leftCalloutAccessoryView
I get
I must be missing something. Note, if I just add an image to the detailCalloutAccessoryView
like
view.detailCalloutAccessoryView = UIImage(named:"YourImageName")
The image is there, size correctly etc
I just cannot figure out how to put in my own custom view.
Thanks