-[UIKBBlurredKeyView candidateList]: unrecognized selector sent to instance 0x17

Scrollview上的输入框无法实现键盘回收,于是引入如下代码来解决这个问题

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [[self nextResponder] touchesBegan:touches withEvent:event];
    [super touchesBegan:touches withEvent:event];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    [[self nextResponder] touchesMoved:touches withEvent:event];
    [super touchesMoved:touches withEvent:event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [[self nextResponder] touchesEnded:touches withEvent:event];
    [super touchesEnded:touches withEvent:event];
}

虽然解决了键盘回收,但是在做手写输入时候,会出现闪退的情况,并报错

-[UIKBBlurredKeyView candidateList]: unrecognized selector sent to instance 0x17

(其他页面做某些操作的时候也会出现问题)
显然出现这个上述方法是不可行,注销该方法。经过查找资料我寻找到一个新的方式来解决这个问题
贴代码

    UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchScrollView)];
    [recognizer setNumberOfTapsRequired:1];
    [recognizer setNumberOfTouchesRequired:1];
    [BKScrollview addGestureRecognizer:recognizer];


- (void)touchScrollView{
    UITextField * name = [topImageView viewWithTag:1];
    UITextField * phoneNum = [topImageView viewWithTag:2];
    UITextField * adress = [topImageView viewWithTag:4];
    [name endEditing:YES];
    [name resignFirstResponder];
    [phoneNum resignFirstResponder];
    [adress resignFirstResponder];
}
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容