手写输入法和重写UIScrollView的touch方法冲突

name:NSInvalidArgumentException

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

之前一个版本线上项目突然大规模出现这个报错信息,[UIKBBlurredKeyView candidateList]这个错误google一下基本都是说scrollview重写了触摸事件和手写输入法冲突。

@implementation UIScrollView (UITouch)

- (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];

}

@end

我确实重写了这几个方法,为了解决scrollview加在uiview上,uiview的点击事件的。但是网上说的几个办法并不行,有人提出重写viewController的touch方法,用ismemberOf区分下scroll,但是我由于用的界面太多,所以没有测试。目前只能暂时先去掉这个类目(毕竟用户数量虽少,闪退是很重的)。

注:我类目头文件只在某个界面的.m文件引入,也变成全局了,别的界面也都影响了。这个令人费解。如果大家对这个有好的解决方法,欢迎留言,或者QQ我,QQ:348031375  备注:简书。

也欢迎更多iOSer来交流

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容