我为标注添加了一个右键,但现在我想为整个气泡/标注添加一个彩色边框。假设我想要带有彩色边框的整个气泡。我想实现一些东西,view?.detailCalloutAccessoryView?.layer.borderWidth = 5.0
view?.detailCalloutAccessoryView?.layer.borderColor = UIColor(red:51/255.0, green:153/255.0, blue:255/255.0, alpha: 1.0).CGColor
但它不起作用
与此类似的东西(我知道他们在这里只添加了红色视图)但里面是白色的,但有彩色边框
//MARK: this is for adding info button to pins on map 1/2
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
var view = mapView.dequeueReusableAnnotationViewWithIdentifier("AnnotationView Id")
if view == nil{
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "AnnotationView Id")
view!.canShowCallout = true
} else {
view!.annotation = annotation
}
//is this right?
view?.rightCalloutAccessoryView = UIButton(type: UIButtonType.DetailDisclosure)
view?.rightCalloutAccessoryView?.layer.borderColor = UIColor(red:222/255.0, green:225/255.0, blue:227/255.0, alpha: 1.0).CGColor
return view
}
//MARK: this is for adding info button to pins on map 2/2
func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
if (control as? UIButton)?.buttonType == UIButtonType.DetailDisclosure {
let annotation = view.annotation as! MyMKPA
self.userToPass = annotation.pointAnnotationPFUser
mapView.deselectAnnotation(view.annotation, animated: false)
performSegueWithIdentifier("fromMapToDetail", sender: view)
}
}