私はswiftを使用して地図を作成しています。 Appleマップに保存されている現在の場所の名前を見つけるにはどうしたらいいですか?私はWalmartにいると言います。場所の名前を印刷するにはどうしたらいいですか?ロケーション名のスウィフトマップを見つける
私の現在のコードは、あなたが名前を配置するために経度と緯度を変換するために、iOSのネイティブAPIを使用することができます
class MapVC: UIViewController, CLLocationManagerDelegate {
@IBOutlet weak var map: MKMapView!
let manager = CLLocationManager()
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[0]
let span:MKCoordinateSpan = MKCoordinateSpanMake(0.01, 0.01)
let mylocation:CLLocationCoordinate2D = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude)
let region:MKCoordinateRegion = MKCoordinateRegionMake(mylocation, span)
map.setRegion(region, animated: true)
print(location.coordinate)
print(location.coordinate.latitude)
print(location.speed)
self.map.showsUserLocation = true
self.map.showsPointsOfInterest = true
}
override func viewDidLoad() {
super.viewDidLoad()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.requestAlwaysAuthorization()
manager.startUpdatingLocation()
}
[都市名への座標変換?](https://stackoverflow.com/questions/27735835/convert-coordinates-to-city-name) – Emm