Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with hidden navigation bar #12

Open
Ruyven opened this issue Dec 8, 2015 · 5 comments
Open

Bug with hidden navigation bar #12

Ruyven opened this issue Dec 8, 2015 · 5 comments

Comments

@Ruyven
Copy link

Ruyven commented Dec 8, 2015

If the presenting ViewController's navigation bar is hidden and you cancel the gesture, the child's navigation bar will also get hidden even though it shouldn't.
Tested on iOS 9 and iOS 8.4.

navigationbarhidden

Steps to reproduce with the example project:

  • make the presenting ViewController's navigation bar hide itself¹
  • run the app and tap Push
  • start swiping back from anywhere
  • push the ViewController back to the left. Do this by letting go and using the inertia, the bug doesn't occur if you swipe all the way back smoothly

Result: The first time you do this, the navigation bar will get hidden. The second time it will get shown again, etc.

¹ e.g. by adding this method to ViewController.m:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    NSUInteger stackCount = [self.navigationController.viewControllers count];
    if (stackCount == 1) {
        [self.navigationController setNavigationBarHidden:true animated:true];
    } else {
        [self.navigationController setNavigationBarHidden:false animated:true];
    }
}
@gastonmorixe
Copy link

anyone solved this?

@yukitoto
Copy link

I also have this issue.

@zzzworm
Copy link

zzzworm commented Jul 19, 2017

- (void)animationEnded:(BOOL)transitionCompleted
{
    // restore the toViewController's transform if the animation was cancelled
    if (!transitionCompleted) {
        self.toViewController.view.transform = CGAffineTransformIdentity;
        //some hack here
        if (nil == [self.fromViewController.navigationController.navigationBar superview] ) {
            //if have bug on ios9 and early, may do some work here
            [self.fromViewController.navigationController setNavigationBarHidden:NO animated:NO];
        }
    }
}

i use this code to fixed it

@lakshaychhabra
Copy link

Anyone Solved it on Swift?

@lakshaychhabra
Copy link

Well I solved it, just make the view controller as child of navigation controller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants