Когда был выбран пользовательский вид моей аннотации (Pin) в MapView, мне нужна белая рамка ВНЕ моей аннотации.
Также мне нужно в тени при нажатии. Но как я мог это сделать? (когда я снимаю выделение, аннотации должны оставаться в правильном стиле). Если я сделаю это с:
var newFrame: CGRect = view.frame; newFrame = newFrame.insetBy (dx: -borderWidth, dy: -borderWidth); view.frame = newFrame; в методе mapView (_ mapView: MKMapView, didSelect view: MKAnnotationView) и установите границу - мое изображение тоже увеличится, но это неправильно.
// 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
}
didSelect
иdidDeselect
MKAnnotationView изMKMapViewDelegate
? - person Miket25   schedule 09.01.2018