When custom my annotation view (Pin) in MapView was tapped, I need in white border OUT of my annotation.
Also I need in shadow, when tapped. But how could I make it? (when I deselect annotation have to stay right style). If I make it with:
var newFrame: CGRect = view.frame; newFrame = newFrame.insetBy(dx: -borderWidth, dy: -borderWidth); view.frame = newFrame; in mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) method and set border - my image will enlarge too, but it isn't right.
// My custom annotation
class CustomPointAnnotation: NSObject, MKAnnotation {
var coordinate: CLLocationCoordinate2D
var restoInfo: Restaurant?
init(resto: Restaurant) {
self.coordinate = resto.coordinate!
self.restoInfo = resto
}
}
// And func adding custom annotation on MapView
var restorationPin: CustomPointAnnotation!
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?
{
let cpa = annotation as? CustomPointAnnotation
if cpa?.restoInfo == nil {
return nil
}
let annotationView = MKAnnotationView(annotation: restorationPin, reuseIdentifier: "id")
let icon = cpa?.restoInfo?.encodeBase64toImage(base64: (cpa?.restoInfo?.logoMap)!)
annotationView.image = icon
annotationView.layer.masksToBounds = true
annotationView.contentMode = .scaleAspectFill
annotationView.frame.size = CGSize(width: 45, height: 45)
annotationView.layer.cornerRadius = 22.5
return annotationView
}


didSelectanddidDeselectMKAnnotationView methods fromMKMapViewDelegate? - Miket25