我正在使用交换手势在视图中工作正常(Ex class A),但是在另一个viewController(Ex - Class B,C)中调用它。我不是在视图上使用navigationController而只是addView .. 代码 -
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的动作。请告诉我任何解决方案。
答案 0 :(得分:0)
设置UserInteractionEnabled = NO
,在其他视图可见时您不希望接收用户操作的视图。当你再次删除其他视图时启用。