Я хочу сделать круглое изображение на карте.Размер изображения 200 * 200 пикселей, но что-то не так с моим cornerRadius после преобразования.Кто-нибудь может мне помочь?
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let annoView = MKAnnotationView(annotation: selectedAnnotation, reuseIdentifier: "")
if (annotation is MKUserLocation){
return nil
}
if(annotation.title! == "Hej"){
annoView.image = UIImage(named: "Hej")
let transform = CGAffineTransform(scaleX: 0.3, y: 0.3)
annoView.transform = transform
annoView.layer.cornerRadius = 100
annoView.layer.masksToBounds = true
let label = UILabel(frame: CGRect(x: annoView.frame.size.width/2, y: annoView.frame.size.height/2, width: 200,height: 30))
label.textColor = #colorLiteral(red: 0.7215686275, green: 0.8862745098, blue: 0.5921568627, alpha: 1)
label.font = UIFont.boldSystemFont(ofSize: 30)
label.center = CGPoint(x: 100, y: 0)
label.textAlignment = .center
label.text = "Hej"
annoView.addSubview(label)
}
}