我试着去弄清楚如何删除以下观察:的iOS如何正确删除观察者
[self.messageInputView.textView addObserver:self
forKeyPath:@"contentSize"
options:NSKeyValueObservingOptionNew
context:nil];
我要清理它在我的dealloc方法。
我已经试过:
[[NSNotificationCenter defaultCenter] removeObserver:self];
但是,这似乎并没有做到这一点。
任何想法?
你添加一个键值观察员,这是你的ViewDidUnload方法不同于'NSNotification'观察者。 – Gavin