ScrollView下的UITextField系统手写输入法造成崩溃的解决办法

来源:互联网 发布:淘宝店怎么提升销量 编辑:程序博客网 时间:2024/05/01 17:24

原因是输入法手势,与本地重写的touchBeagan等方法冲突,解决办法就是在scrollView的category中重写以下方法即可

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {    if (![self isMemberOfClass:[UIScrollView class]]) {    } else {        [[self nextResponder] touchesBegan:touches withEvent:event];        if ([super respondsToSelector:@selector(touchesBegan:withEvent:)]) {            [super touchesBegan:touches withEvent:event];        }    }}-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {    if (![self isMemberOfClass:[UIScrollView class]]) {    } else {        [[self nextResponder] touchesMoved:touches withEvent:event];        if ([super respondsToSelector:@selector(touchesBegan:withEvent:)]) {            [super touchesMoved:touches withEvent:event];        }    }}- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {    if (![self isMemberOfClass:[UIScrollView class]]) {    } else {        [[self nextResponder] touchesEnded:touches withEvent:event];        if ([super respondsToSelector:@selector(touchesBegan:withEvent:)]) {            [super touchesEnded:touches withEvent:event];        }    }}
0 0
原创粉丝点击