UIButton in AnnotationView - My pin view does not update when I added button

Hello,

I'm looking for help with annotationView. What I'm going to do is to have already added icons in annotations, but when Im going to tap the annotation (icon) I would like to see the button in annotation view frame, as in this:

After I click it I would like to see this white frame and uibutton:

I was looking for help in old discussion, but did notg found an answer: UIButton in AnnotationView - How to keep icon and button Here is my viedidload:

        super.viewDidLoad()
        mapView.register(MKMarkerAnnotationView.self, forAnnotationViewWithReuseIdentifier: "identifier") \\ important part
        checkLocationServices()
        znajdzSzczytyNaMapie(szczyty)
        circles = szczyty.map {
                    MKCircle(center: $0.coordinate, radius: 100)
                }
        mapView.addOverlays(circles!)
        mapView.delegate = self
        }

Here in viewdidload I've added mapView.register(MKMarkerAnnotationView.self, forAnnotationViewWithReuseIdentifier: "identifier") to viewdidload to register indentifier. Here is the rest of the code:

      guard !(annotation is MKUserLocation) else { return nil }
      //let annotationView = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: "MyMarker")
      let identifier = "identifier"
      //guard let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? MKMarkerAnnotationView else { return nil }
      guard let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier, for: annotation) as? MKMarkerAnnotationView else { return nil }
      let btn = UIButton(type: .detailDisclosure)
      annotationView.rightCalloutAccessoryView = btn
      switch annotation.title!! {
ase "Turbacz":
              annotationView.markerTintColor = UIColor(red: 0.86, green: 0.99, blue: 0.79, alpha: 1.00)
              annotationView.glyphImage = UIImage(named: "bald")
          case "example":
              annotationView.markerTintColor = UIColor(red: 0.80, green: 0.98, blue: 0.73, alpha: 1.00)
              annotationView.glyphImage = UIImage(named: "bear")
          default:
              annotationView.markerTintColor = UIColor.green
              annotationView.glyphImage = UIImage(named: "gora")
 } 
return annotationView
}

But Still I got this:

UIButton in AnnotationView - My pin view does not update when I added button
 
 
Q