我的应用程序中有键盘通知,它在ios 10中工作正常,但我的通知方法在下面的ios11.3中没有调用,这是我的代码:
- (void)attach {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
}
- (void)keyboardWasShown:(NSNotification*)aNotification {
UIView* responder = [self findFirstResponder];
if (responder) {
_tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAnywhere:)];
[baseView addGestureRecognizer:_tapRecognizer];
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
CGRect screenRect = [RGLayout layout].fullScreen;
CGRect frame = responder.frame ;
}
}我试图找到解决方案,我得到了iOS11中唯一的变化是键盘高度的UIKeyboardFrameEndUserInfoKey。
但我的问题是,我的keyboardWasShown没有在ios11.3中调用,同样的代码可以在iOS10.2中运行
仅供参考:当用户单击下一步时,下一个textField将becomeFirstResponder。
https://stackoverflow.com/questions/51193470
复制相似问题