How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem?

Itachi

I got the opposite issue from here. By default in iOS7, back swipe gesture of UINavigationController's stack could pop the presented ViewController. Now I just uniformed all the self.navigationItem.leftBarButtonItem style for all the ViewControllers.

Here is the code:

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:LOADIMAGE(@"back_button") style:UIBarButtonItemStylePlain target:self action:@selector(popCurrentViewController)];

after that, the navigationController.interactivePopGestureRecognizer is disabled. How could I make the pop gesture enabled without removing the custom leftBarButtonItem?

Thanks!

Lumialxk

First set delegate in viewDidLoad:

self.navigationController.interactivePopGestureRecognizer.delegate = self;

And then disable gesture when pushing:

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    [super pushViewController:viewController animated:animated];
    self.interactivePopGestureRecognizer.enabled = NO;
}

And enable in viewDidDisappear:

self.navigationController.interactivePopGestureRecognizer.enabled = YES;

Also, add UINavigationControllerDelegate to your view controller.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to disable back swipe gesture in UINavigationController on iOS 7

From Java

How do I Disable the swipe gesture of UIPageViewController?

From Dev

Gesture recognizer (swipe) on UIImageView

From Dev

iOS 7 uinavigationcontroller how to detect swipe?

From Dev

Combine UIPageViewController swipes with iOS 7 UINavigationController back-swipe gesture

From Dev

How do I enable Voice Over 3 finger swipe gesture for UIPageViewController

From Dev

Add swipe gesture to UITableView

From Dev

Can a UIWebView in a UINavigationController allow the iOS 7 swipe-to-pop built-in gesture to be recognized?

From Dev

UIButton control with swipe gesture

From Dev

Back swipe gesture is not work when I add the leftBarButtonItem

From Dev

UISplitViewController swipe gesture interferes with other swipe gesture

From Dev

How do disable back swipe gesture in UINavigationController in iOS 8?

From Dev

How to move a sprite using swipe gesture?

From Dev

Ionic swipe back gesture enable

From Dev

How to get IndexPath and UItableView on Swipe gesture

From Dev

How to use pan gesture and a swipe gesture alternatively on the same view?

From Dev

How to add swipe gesture to segmented control?

From Dev

enable disable swipe gesture swift

From Dev

How to enable full screen Pan back for UINavigationController

From Dev

How to perform a segue with a swipe right gesture

From Dev

How to move a sprite using swipe gesture?

From Dev

How to add Swipe Gesture?

From Dev

How to Implement a UILongPressGesture followed by Swipe gesture in ios

From Dev

enable disable swipe gesture swift

From Dev

How to enable full screen Pan back for UINavigationController

From Dev

to increase the inset required to invoke the swipe back gesture on UINavigationController

From Dev

How to add a swipe gesture to a node in spritekit

From Dev

How to enable leftBarButtonItem from other ViewController?

From Dev

How to detect gesture between swipe and drag?

Related Related

  1. 1

    How to disable back swipe gesture in UINavigationController on iOS 7

  2. 2

    How do I Disable the swipe gesture of UIPageViewController?

  3. 3

    Gesture recognizer (swipe) on UIImageView

  4. 4

    iOS 7 uinavigationcontroller how to detect swipe?

  5. 5

    Combine UIPageViewController swipes with iOS 7 UINavigationController back-swipe gesture

  6. 6

    How do I enable Voice Over 3 finger swipe gesture for UIPageViewController

  7. 7

    Add swipe gesture to UITableView

  8. 8

    Can a UIWebView in a UINavigationController allow the iOS 7 swipe-to-pop built-in gesture to be recognized?

  9. 9

    UIButton control with swipe gesture

  10. 10

    Back swipe gesture is not work when I add the leftBarButtonItem

  11. 11

    UISplitViewController swipe gesture interferes with other swipe gesture

  12. 12

    How do disable back swipe gesture in UINavigationController in iOS 8?

  13. 13

    How to move a sprite using swipe gesture?

  14. 14

    Ionic swipe back gesture enable

  15. 15

    How to get IndexPath and UItableView on Swipe gesture

  16. 16

    How to use pan gesture and a swipe gesture alternatively on the same view?

  17. 17

    How to add swipe gesture to segmented control?

  18. 18

    enable disable swipe gesture swift

  19. 19

    How to enable full screen Pan back for UINavigationController

  20. 20

    How to perform a segue with a swipe right gesture

  21. 21

    How to move a sprite using swipe gesture?

  22. 22

    How to add Swipe Gesture?

  23. 23

    How to Implement a UILongPressGesture followed by Swipe gesture in ios

  24. 24

    enable disable swipe gesture swift

  25. 25

    How to enable full screen Pan back for UINavigationController

  26. 26

    to increase the inset required to invoke the swipe back gesture on UINavigationController

  27. 27

    How to add a swipe gesture to a node in spritekit

  28. 28

    How to enable leftBarButtonItem from other ViewController?

  29. 29

    How to detect gesture between swipe and drag?

HotTag

Archive