I'm navigating from a UITableView to a normal ViewController.
I'm displaying the navigationBar like this:
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
The first time I hit a row in the UITableView, the navigationBar shows up, but the second time it remains hidden. This is not expected behavior, since viewWillAppear should work every time the view shows up.
Why is the navigationBar hidden when viewing the view for the second time?
This is because you are hiding navigation bar in viewWillAppear of table view. So it will hidden for other pushed view controllers. So in order to get rid of that you have to un hide navigation bar in view did disappear of table view.So it will work in desired manner.
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.navigationController.navigationBar.hidden = NO;
}
Related
as picture : when the white controller in popping out with a interactive pop gesture , the red controller (which make the status bar hide) will show, and during the animation : the navigation bar seems to move up , and the controller's view is still in its position (not move up with navigation bar) ,so the view seems divided into two pieces in the pop out animation . how to fix it ?
In the first controller,add this code.
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
I have two views, in the first i display the log in page which has a uiimage and i hide made the navigation bar translucent and in the second i have a collection view but when i scroll the navigation bar is still translucent so... i want it to be solid in the second view.
i put in the viewdidload from the second view this:
[super viewDidLoad];
self.edgesForExtendedLayout = UIRectEdgeNone;
but when i go to the second view the uiimage of the first view is late to disappear.
what ca i do?
on the first view
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.translucent = YES;
}
on the second view
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.translucent = NO;
}
I have a customized tabbar in my app. I want to hide my tabbar when pushing another viewcontroller.
Currently I implemented as this(The original tabbar has been hidden):
myViewController.hidesBottomBarWhenPushed = YES;
((CustomTabBarController *)self.tabBarController).customTabBar.hidden = YES;
[self.navigationController pushViewController:lookBookViewController animated:YES];
But when it is being pushed, it hides my customTabBar immediately. So you can see a black bottom bar in first viewcontroller. Is there a way to fix this problem?
Thanks.
put your these code in - (void)viewDidDisappear:(BOOL)animated;
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
myViewController.hidesBottomBarWhenPushed = YES;
((CustomTabBarController *)self.tabBarController).customTabBar.hidden = YES;
}
you can design like this
and then you need not to hide the tabbar , if you want to hide it , you can use my above code , I think if you design like this , the hide effect will be you want
I am making an app which has a UITabBar and a UINavigationConroller. When I click around the app, the nav item on top of the screen appears and so does the UITabBar on the bottom of the screen.
But when I click on one of the UITabBar items, it does go to the screen it is supposed to go to, but for some reason the UINavigationItem disappears.
Would anyone know why this happens?
Thanks!
IN all of your ViewController use the following Code.
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:YES];
}
When you want to show Navigationcontroller use Hidden:NO
I have a view with a custom bar at the bottom of the screen. When a collection view cell is pressed, it loads a detail view, and I can go back.
This all works great; however, I have a plus button displayed on the custom bar, and I would like for the plus button to disappear only when the detail view shows up, and then come back when you hit the back button.
So far I have used the delegate method:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
// Your code to update the parent view
}
The problem is this fires when the detail view is loaded and popped as well. Any idea on how to accomplish this? Thanks!
I assume mainView and detailView are viewControllers. In mainView's viewWillAppear method
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//get reference of plus button here
btnPlus.hidden = NO;
}
In detailView's viewWillAppear method
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//get reference of plus button here
btnPlus.hidden = YES;
}