【发布时间】:2010-12-01 04:01:26
【问题描述】:
我有一个大约 600 像素高和 320 像素宽的 UIScrollView。所以我允许用户垂直滚动。
我也在尝试捕捉视图上的水平滑动。问题似乎是,当用户通过一些意外的垂直移动水平滑动时,UIScrollView 滚动并且我的 touchesEnded 委托方法永远不会被调用。
这是我的代码:
- (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint currentPosition = [touch locationInView:self];
if (currentPosition.x + 35 < gestureStartPoint.x)
{
NSLog(@"Right");
}
else if (currentPosition.x - 35 > gestureStartPoint.x)
{
NSLog(@"Left");
}
else if (!self.dragging)
{
[self.nextResponder touchesEnded: touches withEvent:event];
}
[super touchesEnded: touches withEvent: event];
}
有谁知道即使涉及垂直拖动,我如何才能让它工作?
【问题讨论】:
标签: ios uiscrollview uikit