Ios ICViewPager从我的uislider截取触摸事件
我使用ICViewPager作为带有选项卡的滚动视图。当我在视图中放置滑块时,用户必须在移动它之前按下滚动旋钮一秒钟,否则整个页面都会随着滑块移动 我试过: 将滑块设置为exclusiveTouch 创建滑块控制器并将触摸事件直接发送到滑块Ios ICViewPager从我的uislider截取触摸事件,ios,uislider,Ios,Uislider,我使用ICViewPager作为带有选项卡的滚动视图。当我在视图中放置滑块时,用户必须在移动它之前按下滚动旋钮一秒钟,否则整个页面都会随着滑块移动 我试过: 将滑块设置为exclusiveTouch 创建滑块控制器并将触摸事件直接发送到滑块 -(CGRect)thumbRect { CGRect trackRect = [self trackRectForBounds:self.bounds]; CGRect thumbRect = [self thumbRectForBounds:self.b
-(CGRect)thumbRect
{
CGRect trackRect = [self trackRectForBounds:self.bounds];
CGRect thumbRect = [self thumbRectForBounds:self.bounds
trackRect:trackRect
value:self.value];
return thumbRect;
}
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
CGRect thumbFrame = [self thumbRect];
// check if the point is within the thumb
if (CGRectContainsPoint(thumbFrame, point))
{
// if so trigger the method of the super class
NSLog(@"inside thumb");
return [super hitTest:point withEvent:event];
}
else
{
// if not just pass the event on to your superview
NSLog(@"outside thumb");
return [[self superview] hitTest:point withEvent:event];
}
}
有同样的问题。我通过使用自定义滑块找到了一个解决方法,并使用UIgestureRecognitor代替了ToucheSpender和touchesEnded函数