*Question is : How can i make the button (when pressed) open the link witch corresponds to the chosen shop on the pin?
I have an array of shops (for pins) (i created a class for it, and a class for pinAnnotation)
here i am creating button and pin image
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let identifier = "annotationReusedId"
var anView = myMapView.dequeueReusableAnnotationView(withIdentifier: identifier)
if anView == nil {
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: identifier)
} else {
anView!.annotation = annotation
}
anView!.image = UIImage(named: "upcycled")
anView?.frame = CGRect(x: 0, y: 0, width: 35, height: 35)
anView!.backgroundColor = UIColor.clear
anView!.canShowCallout = true
let rightButton = UIButton(type: .infoLight)
rightButton.tag = annotation.hash
rightButton.addTarget(self, action:#selector(openLinkInstagram), for: .touchUpInside)
//anView!.animatesDrop = true
anView!.canShowCallout = true
anView!.rightCalloutAccessoryView = rightButton
return anView
}
here is func for openning link
func openLinkInstagram() {
}