0

我正在使用交换手势,它在视图(Ex 类 A)中工作正常,但它在另一个视图控制器(Ex - B 类,C)中调用。我没有使用 navigationController 只是 addView on view .. 代码 -

swipeLeftRecognizer                             = nil;
swipeLeftRecognizer                             = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
swipeLeftRecognizer.direction                   = UISwipeGestureRecognizerDirectionLeft;
swipeLeftRecognizer.numberOfTouchesRequired     = 1;
swipeLeftRecognizer.delegate                    = self;
     swipeLeftRecognizer.cancelsTouchesInView   = NO;
[self.view addGestureRecognizer:swipeLeftRecognizer];

swipeRightRecognizer                            = nil;
swipeRightRecognizer                            = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
swipeRightRecognizer.direction                  = UISwipeGestureRecognizerDirectionRight;
swipeRightRecognizer.numberOfTouchesRequired    = 1;
swipeRightRecognizer.delegate                   = self;

 swipeRightRecognizer.cancelsTouchesInView        = NO;
[self.view addGestureRecognizer:swipeRightRecognizer];

因此,我无法在另一个视图(B,C)中提供 Button 的操作。请告诉我任何解决方案。

4

1 回答 1

0

设置UserInteractionEnabled = NO, 在您不希望在其他视图可见时接收用户操作的视图上。并且当您删除其他视图时再次启用。

于 2013-09-25T14:40:10.360 回答