-[UITextTapRecognizer velocityInView:]: unrecognized selector sent to instance 0x6080003c3a20
来源:互联网 发布:nginx 源码 编辑:程序博客网 时间:2024/05/21 10:08
今天遇到一个错误调了一下午,终于解决。分享一下问题的始末。
错误:点击UITextView 是程序崩溃。
错误提示:
-[UITextTapRecognizer velocityInView:]: unrecognized selector sent to instance 0x6080003c3a20
错误原因:昨天下午处理 侧滑返回手势 和 scrollView滑动冲突的时候写了一个Category:UIScrollView+Extension。重写了
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer这个方法。
//左边侧滑:解决侧滑返回 与 UIScrollView 冲突- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ CGPoint velocity = [(UIPanGestureRecognizer *)gestureRecognizer velocityInView:self]; CGPoint location = [gestureRecognizer locationInView:self]; if (velocity.x > 0.0f&&(int)location.x%(int)[UIScreen mainScreen].bounds.size.width<60) { return NO; } return YES;}
方法具体如上;
UITextView 继承自 UIScrollView,所以在点击的时候调用了上面的方法,所以崩溃。
解决方法:就是上面的那个方法不能放在Category中了,或者在上面那个方法中加判断。
(ps:一开也没有想到崩溃会是这个原因,后来看到UITextView 继承自 UIScrollView,然后才想起来昨天加的那个方法。看来是一些基础知识不过关啊!)
0 0
- -[UITextTapRecognizer velocityInView:]: unrecognized selector sent to instance 0x6080003c3a20
- unrecognized selector sent to instance 0x81de740
- unrecognized selector sent to instance 0x266070
- unrecognized selector sent to instance 0x266070
- unrecognized selector sent to instance 0x10b34e810
- unrecognized selector sent to instance 0x266070
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- [NSCFType XXX]: unrecognized selector sent to instance 0x4d80b00'
- Swift_继承
- KIWI祭
- C和指针读书笔记(第十四章)
- 为什么绝大多数抄袭的游戏会失败?
- compileSdkVersion为23以下的应用运行在Android6.0的拍照权限处理(拍照时onActivityResult的data返回为null的处理办法)
- -[UITextTapRecognizer velocityInView:]: unrecognized selector sent to instance 0x6080003c3a20
- UIAlertViewController 基本使用+自定义(字体颜色,大小,对齐方式)
- 易答语音问答是什么?
- 零预算如何获得 620 万 PV 和 144920 个粉丝
- ACM/IOI 历年国家集训队论文集和论文算法分类整理
- 对卷积的简单理解
- Android版本对于SDK
- Eclipse Hadoop插件安装
- 1、markdown编辑器