2011年1月6日木曜日

NSNotificationの解除

NSNotificationを登録したらdeallocで以下を入れておく。
登録したNotificationを全て削除できる。便利。
[[NSNotificationCenter defaultCenter] removeObserver: self];

notification名を指定して削除もできる。
一つだけ削除するとか何か意味があるんだろうか…?
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"notificationname" object:nil];