我目前拥有的:
UIViewController
我的main 里面有一个孩子UIViewController
。在这个孩子中,UIViewController
我有一个UITableView
,尽管它里面可以有任何东西(UIScrollView
, UIImageView
, 不同UIViews
子类的组成)。
在我的 mainUIViewController
我有GestureRecognizerDelegate
,所以我在做出手势时收到回调,如下所示:
- (void)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer movedWithTouches:(NSSet*)touches andEvent:(UIEvent *)event;
- (void)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer endWithTouches:(NSSet*)touches andEvent:(UIEvent *)event;
@optional
- (void)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer beganWithTouches:(NSSet*)touches andEvent:(UIEvent *)event;
对于在 main 之上完成的特定手势UIViewController
,我展示了一个UIView
带有UIImageView
. 因此,基本上,当从顶部到底部进行触摸时,Y < 100 的 UIView 动画并显示图像,当我从屏幕上松开手指时,UIView
返回顶部。它很像 Apple 提供的通知中心,只是我不控制它的滚动,它只显示距离顶部 200 像素的区域。
问题:
理论上UIView
with theUIImage
是我的层次结构中最高的UIView
,但是当我用手指在它的区域上继续移动时,我可以看到它UITableView
下面的移动。对我来说这没有意义,因为UIView
with theUIImageView
应该捕捉这些手势。
我想要的是:
只是当我显示UIView
禁用UIImage
所有交互时childViewController
。
我试过的:
目前我有这个:
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
如果我设置为 NO,则UIView
withUIImage
甚至不会显示。
如果我放了类似的东西myChildViewController.view.userInteractionEnabled = NO
,因为手势已经开始,所以它不起作用。当然,如果我在手势开始之前使用它,一切都会按预期工作。但问题是我将无法使用UITableView
.