首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ios 11.3中未调用键盘通知

在ios 11.3中未调用键盘通知
EN

Stack Overflow用户
提问于 2018-07-05 22:10:11
回答 0查看 256关注 0票数 1

我的应用程序中有键盘通知,它在ios 10中工作正常,但我的通知方法在下面的ios11.3中没有调用,这是我的代码:

代码语言:javascript
复制
- (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。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51193470

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档