Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

PushViewController with NavigationBarHidden = YES #21

Closed
basilmariano opened this issue Aug 5, 2014 · 2 comments
Closed

PushViewController with NavigationBarHidden = YES #21

basilmariano opened this issue Aug 5, 2014 · 2 comments

Comments

@basilmariano
Copy link

Hi,
I have been using this library since you published, and I really like it so much!
and I am using this on my current project right now, :)

I have just small issues:

I have project that pushes to navigation on appear setNavigationBarHidden = YES

The effect is:

  • the navigationBar will be hidden on the transition effect and the extensionView will be left shown (seems not good to see)

question:

  1. Can we also set the extensionView hidden when Navigation is hidden?
  2. when pushed and the extensionView and the navigation is hidden, can we let it be hidden upon push to another viewController? because right now when I push, It automatically shows the navigation and extensionView

Sorry for noob question :)

@Mazyod
Copy link
Contributor

Mazyod commented Aug 5, 2014

Hi @basilmariano, I am glad you liked it.

If I understand the question correctly, you are making the setNavigationBarHidden: call in a view controller that uses the shyNavBar? If that is the case, it probably won't work, since you are hiding the navigation bar anyway, why would you want to attach the shyNavBarManager to it?

If you mean the shyManager is attached to the previous controller, it should work, I just tested it myself. Make sure your call is like this:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

Cheers,

@joshbernfeld
Copy link

If you are pushing to a view controller that does not have a shyNavBar from a view controller that does have a shyNavBar and you are hiding the nav bar in viewWillAppear of the new controller it will not work. Here is the solution that works great for me.


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

    //We have to manually animate hiding the nav bar because TLYShyNavBar prevents
    //[self.navigationController setNavigationBarHidden:YES animated:YES]; from animating properly.
    //First animate the bar out in viewWillAppear:, then call setNavigationBarHidden: in viewDidAppear:
    //This will allow user interaction underneath where the bar would normally be.

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.25];
    self.navigationController.navigationBar.alpha = 0;
    [UIView commitAnimations];
}

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

    [self.navigationController setNavigationBarHidden:YES animated:NO];
}


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

    //Prevents showing the navigation bar when moving to another of the same controller
    if (![self.navigationController.topViewController isKindOfClass:[YourViewController class]]) {
        [self.navigationController setNavigationBarHidden:NO animated:YES];

        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.25];
        self.navigationController.navigationBar.alpha = 1;
        [UIView commitAnimations];
    }

}

@Mazyod Mazyod closed this as completed Nov 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants