Advertisement
Guest User

CenterMapOnLocatiom

a guest
Mar 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.71 KB | None | 0 0
  1. /* Set up and load map. Add user annotation pin to map. */
  2.     private func centerMapOnLocation(location: CLLocation) {
  3.         ratingLocationMap.delegate = self
  4.        
  5.         let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate, 100, 100)
  6.         ratingLocationMap.setRegion(coordinateRegion, animated: true)
  7.        
  8.         let userLocation = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
  9.        
  10.         userAnnotation = MapAnnotation(name: "You are here",  distanceKM: nil, pinImageValue: "userPin", coordinate: userLocation)
  11.        
  12.         ratingLocationMap.addAnnotation(userAnnotation)
  13.     }   // centerMapOnLocation()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement