Advertisement
Guest User

Untitled

a guest
Jan 14th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.86 KB | None | 0 0
  1.     func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
  2.         if (annotation is MKUserLocation){
  3.             return nil
  4.             }
  5.         else{
  6.             let reuseId = "pin"
  7.            
  8.             var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId) as? MKPinAnnotationView
  9.            
  10.             if pinView == nil {
  11.                 pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
  12.                 pinView!.canShowCallout = false
  13.                 pinView!.pinTintColor = .red
  14.                 pinView!.animatesDrop = true
  15.                 pinView!.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
  16.             }
  17.             else {
  18.                 pinView!.annotation = annotation
  19.             }
  20.                 return pinView
  21.         }
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement