GPSを使って取得した緯度経度に該当する住所の情報を取得したい場合には、MapKitが提供しているMKReverseGeocorderを使うと便利です。
MKReverseGeocorderを使う時のポイントは、以下の通りです。
- MKReverseGeocoderのインスタンスを作成し、delegateを設定。delegateには、MKReverseGeocoderDelegateプロトコルを実装しているオブジェクトを設定する。
- MKReverseGeocoderのstartを呼び出すことで、プレースマークの取得処理が始まる。(結果は非同期で返される)
- プレースマークが取得できた場合には、MKReverseGeocoderDelegate の reverseGeocoder:didFindPlacemark: が呼び出される。
- プレースマークが取得できなかった場合には、MKReverseGeocoderDelegate の reverseGeocoder:didFailWithError: が呼び出される。
以下に、実装例を示します。
以下は、GPSからの位置情報を取得した後に、MKReverseGeocoderを使ってプレースマークを取得する場合の実装例です。
-- MyViewController.h --
-- MyViewController.m --
"That's what's cool about working with computers. They don't argue, they remember everything, and they don't drink all your beer." (Paul Leary)
I am stricken by the way you embraced this topic. It is not often I come across a website with interesting articles like yours. I will bookmark your feed to keep up to date with your upcoming updates.Just striking and do continue up the good work.
I've heard that placing advertisements on a person's website earns them revenue. In other words money for the owner. Is this true for you and every other site that display advertisements?
When you read about all of this, it sounds like men have no hope. It seems that almost the whole world is out to get them.