NSNotificationがものすごく便利なような気がする。
http://web.me.com/yanosatoshi/weblog/SYNotes_/エントリー/2009/1/14_NSNotification,_NSNotificationCenter.html
こんなに便利NSNotification。NSNotificationを使えば、親関係とか無視してイベントの通知ができるかも!?
// これでセンターにイベントを投稿。 [[NSNotificationCenter defaultCenter] postNotificationName:@"イベント名を自分でつくる。" object:"なんでもいいので渡しちゃおう。"]; // どのクラスでもいいので受け取る設定をする。 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(通知が送られて来た場合に実行する関数を設定) name:@"上のイベント名と同じものを設定。" object:nil]; // 通知が送られてきた時に実行する関数を実装する。 - (void) hoge:(NSNotification *)notification { }
やってみよう!
次は、reverseGeocodingの仕方。
http://www.fourmeisters.com/iphone-lab/ja/2009/09/mkreversegeocodermkplacemark.html
だいたいの概要は
- ReverseGeocoderのデリゲートメソッドを設定。
- ReverseGeocodingを使いたいと思う。
- startというメソッドを使って「はい、変換してきてねー」
- 変換できなかった場合はデリゲートメソッドのdidFailWithErrorが呼ばれる。これも頑張って実装です!
- 変換できた場合はデリゲートメソッドのdidFindPlacemarkが呼ばれる。
思ったんだが、大規模なアプリを作る時はTodoリストを紙に書いてみるのもいいかもねー。