Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change image of rightCalloutAccessoryView's button of annotation view in Map view

Tags:

ios

swift

how to change image of rightCalloutAccessoryView's button of annotation view in Map view? I have used following method to set button in annotation view.

annotationView!.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)

(annotationView?.rightCalloutAccessoryView as! UIButton).setImage(UIImage(named: "abc"), for: .normal)

I have also tried with custom button, it won't change

like image 618
Dipal Patel Avatar asked Sep 05 '25 16:09

Dipal Patel


1 Answers

Swift 4

Create your button, set the image and assign in rightCalloutView.

let annotationView = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: identifier)
let rightButton = UIButton(type: .detailDisclosure)
rightButton.setImage( UIImage(named: "map1"), for: .normal)
annotationView.rightCalloutAccessoryView = rightButton
like image 108
Ariel Antonio Fundora Avatar answered Sep 08 '25 11:09

Ariel Antonio Fundora