func onClickMyButton(sender: UIButton) {
// geocoderを作成.
let myGeocorder = CLGeocoder()
// locationを作成.
let myLocation = CLLocation(latitude: myLat, longitude: myLon)
// 逆ジオコーディング開始.
myGeocorder.reverseGeocodeLocation(myLocation, completionHandler: { (placemarks, error) -> Void in
for placemark in placemarks! {
print("Name: \(
placemark.name)")
print("Country: \(
placemark.country)")
print("ISOcountryCode: \(placemark.isoCountryCode)")
print("administrativeArea: \(placemark.administrativeArea)")
print("subAdministrativeArea: \(placemark.subAdministrativeArea)")
print("Locality: \(placemark.locality)")
print("PostalCode: \(placemark.postalCode)")
print("areaOfInterest: \(placemark.areasOfInterest)")
print("Ocean: \(placemark.ocean)")
// pinのタイトルとサブタイトルを変更する.
self.myPin.title = "\(
placemark.country)"
self.myPin.subtitle = "\(
placemark.name)"
}
})
}