【发布时间】:2013-02-02 13:23:34
【问题描述】:
我通过在 ViewDidLoad 中添加此代码来检测键盘的显示/隐藏:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidHide:)
name:UIKeyboardDidHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
虽然我想删除这些观察者,但不调用
[[NSNotificationCenter defaultCenter] removeObserver:self];
因为这会移除所有观察者,而我还有其他不想移除的观察者。我怎样才能只删除这两个??
【问题讨论】:
标签: ios objective-c nsnotificationcenter nsnotifications