質問

I have a UINavigationController that has a UIPanGestureRecognizer:

MyNavController.m
...

menuGesture.delegate = self;
[self.view addGestureRecognizer:menuGesture];

It works great, but I need to ignore that UIPanGestureRecognizer in one of my topViewControllers. I tried self.view.gestureRecognizers = nil, but it didn't work.

役に立ちましたか?

解決

If you need to enable/disable some gesture recognizers that you have added in your controllers, one approach would be exposing that gesture recogniser through a property and then enable/disable it at will:

@property(nonatomic, assign/weak) UIPanGestureRecognizer* myGestureRecognizer;

...

[(MyNavController*)myController.navigationController myGestureRecognizer].enabled = NO;

(of course, your menuGesture would be stored in myGestureRecognizer for this to work).

他のヒント

You'll want to subscribe to the UIGestureRecognizerDelegate and then determine if the gesture should be allowed in gestureRecognizer:shouldReceiveTouch:

try like this :UINavigationController has a method called

- (void)removeGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top