Guest User

Untitled

a guest
Oct 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. func centerMapOnLocation(location:CLLocation){
  2.  
  3. let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate, regionRadius * 2 , regionRadius * 2)
  4. map.setRegion(coordinateRegion, animated: true)
  5. }
  6.  
  7. func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation){
  8. if let loc = userLocation.location {
  9. centerMapOnLocation(location: loc)
  10. locationManager.stopUpdatingLocation()
  11.  
  12. }
  13. }
Add Comment
Please, Sign In to add comment