在我的应用中我遇到这种情况: 我有我的主视图控制器,我在其中分配“flipwiecontroller”并以这种方式添加其视图
self.flipViewController.view.frame = CGRectMake (...);
[self.view addSubview:self.flipViewController.view];
在这个flipViewController中我添加了一些手势(作为pangesture,swipegesture和tapgesture用于我在其上使用的一些控件)
当我按下此视图中的按钮时,我以这种方式分配另一个viewcontroller“paintingviewcontroller”
[self.view addSubview:paintingViewController.view];
在第二个视图控制器中我有一些按钮和另一个功能,但是当我尝试进行swipegesture或tapgesture时它会识别我的“flipviewcontroller”的事件
我不明白,如果我在另一个viewcontroller上添加一个视图控制器,为什么flipviewcontroller的手势是活动的呢?
thnaks
答案 0 :(得分:1)
也许你在paintingViewController上禁用userIntercation,然后,它的事件被发送到他的superview。
您也可以使用[UIView removeGestureRecognizer:UIGestureRecognizer]
删除手势。
答案 1 :(得分:0)
你是如何添加手势识别器的?它们应该添加到视图中,而不是窗口中。也许这就是问题所在。
如果你有这样的话:
[self.view.window addGestureRecognizer:panGestureRecognizer];
您应该将其更改为:
[self.view addGestureRecognizer:panGestureRecognizer];