Objective c 键盘隐藏和显示方法多次在另一个视图上调用
当我们在另一个视图上时,我的键盘将隐藏并显示方法调用。 这是我的第一个观点 将显示“打开视图”Objective c 键盘隐藏和显示方法多次在另一个视图上调用,objective-c,iphone,Objective C,Iphone,当我们在另一个视图上时,我的键盘将隐藏并显示方法调用。 这是我的第一个观点 将显示“打开视图” [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name: UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self sele
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name: UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden:) name:UIKeyboardWillHideNotification object:nil];
在视图中,将消失
-(void)viewWillDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil];
}
在第二个视图中,他们的文本字段处于编辑状态
他们称我的键盘为隐藏代码。这不是我想要的。您需要删除
UIKeyboardWillShowNotification
和UIKeyboardWillHideNotification
的观察者,而不是UIKeyboardDidShowNotification
和UIKeyboardDidenotification
。这可能会解决您的问题