![](/img/trans.png)
[英]Calling a View's method from its own View Controller, Not Working
[英]GestureProblem: method not disable its calling next view
我正在使用交换手势,它在一个视图中正常工作(例如A类),但是在另一个viewController中调用它(例如-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的操作。 请告诉我任何解决方案。
在不希望看到其他视图时要接收用户操作的视图上,设置UserInteractionEnabled = NO
。 并在删除其他视图时再次启用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.