-
To show map in mapview
let initlocation:CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: 1.34549354899945, longitude: 103.83823575360742) let regionradius:CLLocationDistance = 30000 let region = MKCoordinateRegionMakeWithDistance(initlocation, regionradius, regionradius) singaporeMap.setRegion(region, animated: true)
-
Init location manager
func initloactionManger() { locationmanager.delegate = self if CLLocationManager.locationServicesEnabled() { switch CLLocationManager.authorizationStatus() { case .notDetermined, .restricted, .denied: locationmanager.requestWhenInUseAuthorization() case .authorizedWhenInUse, .authorizedAlways: locationEnabled = true locationmanager.desiredAccuracy = kCLLocationAccuracyBest locationmanager.distanceFilter = 25 locationmanager.startUpdatingLocation() currentlocation = nil default: return } } }
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至[email protected]
近期评论