Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let manager = CLLocationManager()
- func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
- let location = locations[0]
- let span:MKCoordinateSpan = MKCoordinateSpanMake(0.01, 0.01)
- let actLocation:CLLocationCoordinate2D = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude)
- let region:MKCoordinateRegion = MKCoordinateRegionMake(actLocation, span)
- map.setRegion(region, animated: true)
- self.map.showsUserLocation = true
- }
- override func viewDidLoad()
- {
- super.viewDidLoad()
- manager.delegate = self
- manager.desiredAccuracy = kCLLocationAccuracyBest
- manager.requestWhenInUseAuthorization()
- manager.startUpdatingLocation()
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement