【发布时间】:2012-08-02 20:54:08
【问题描述】:
我正在制作一个 iPad 应用程序,您可以在其中随时用 3 根手指在整个屏幕上滑动/平移(取消操作) 它与 UISwipeGestureRecognizer 或 UIPanGestureRecognizer 一起使用,但我手指下方的子视图(例如 UITableView 或 UIScrollview)收到了触摸和移动。这是我不想要的。
我的想法是在整个应用程序顶部放置一个透明的 UIView,它会将触摸转发到其他视图或不转发。我用 hitTest 尝试了一些东西,但我认为我不太了解它,因为返回的触摸次数不正确并且需要时间......
如果你能帮助我,非常感谢:)
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
if (event.type == UIEventTypeTouches) {
if (event.allTouches.count >= 2) {
return self;
}
}
return [super hitTest:point withEvent:event];
}
【问题讨论】:
标签: ios uiview uigesturerecognizer uitouch