标签:
self.scrollView.panGestureRecognizer.delaysTouchesBegan = YES;
设置scrollView的延迟接收点击触摸事件,关闭触摸事件
self.scrollView.delaysContentTouches = YES; button无法识别点击事件
既要能实现button点击效果,又要实现画板画画无延迟,那么解决办法来啦~
首先要设置scrollView的两个属性
self.scrollView.canCancelContentTouches = YES;
self.scrollView.delaysContentTouches = NO;
-(BOOL)touchesShouldCancelInContentView:(UIView *)view{
if ([view isKindOfClass:[UIButton class]]) {
return YES;
}
return [super touchesShouldCancelInContentView:view];
}
//在触摸事件开始相应前调用
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
{
if ([view isKindOfClass:[HBSignView class]]||[view isKindOfClass:[UIButton class]]) {
return YES;
}
return NO;
}
原创:原文链接:http://www.jianshu.com/p/c57ed75e563c
标签:
原文地址:http://www.cnblogs.com/hualuoshuijia/p/5894979.html