In my Main Window IB file I have a TabBarController and the first controller is a Navigation Controller. When I push my detail view (after pressing a cell in a table view) I want to push my detail view and display a tool bar instead of the tab bar. The problem is that when I try
tabBar.hidden = visible;
in my detail view controller (viewDidLoad) the tabbar dissapears before the animation between the first view and the detail view is done.
What i want to achieve can be seen in the native photo app when pressing on one of the images from a gallery. There the tabbar moves out with the animation of the first view.
How do I achieve this?
Thanks in advance
check out the 'hidesBottomBarWhenPushed' property on your detail's page subclass of UIViewController
either override this method
- (BOOL)hidesBottomBarWhenPushed
{
return YES;
}
or i'm guessing this would work the same:
self.hidesBottomBarWhenPushed = YES;
as far as showing the toolbar try:
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setToolbarHidden:NO animated:YES];
}
and on the way out
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setToolbarHidden:YES animated:YES];
}
Related
I am developing navigation base app in iPhone, I hide navigation bar for whole project in app delegate and show on specific view controller where i need. So I unhide navigation bar in xyz view controller when I pop from this xyz controller navigation bar gets hide on animation of popping view controller. Below I have attached screen shots of this strange behavior.
After Pushing View controller actual Image.
On Popping View Controller.
Thanks in advance.
In XYZ viewController,
- (void)viewWillDisappear:(BOOL)animated
{
self.navigationController.navigationBarHidden = NO;
}
If you unhide navigation bar any of controller then it will display in all application if you does not hide it. So if you want to show in only screen then in viewWillApper,make it unhide and in viewWillDisapper make it hide.
-(void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBarHidden = FALSE;
[super viewWillAppear:animated];
}
-(void)viewWillDisappear:(BOOL)animated
{
self.navigationController.navigationBarHidden = TRUE;
[super viewWillDisappear:animated];
}
Hope this will help you.
I have a navigation controller (navC) and I have a view controller (ViewC) which is a view pushed from root controller. I have hidden back button for ViewC with code:
[[self navigationItem] setHidesBackButton:YES];
I have pushed tab bar controller (tabbarC) after ViewC . In the view controller associated with the first tab in tabbarC I have tried hiding the back button with the code:
[[[self tabBarController] navigationItem] setHidesBackButton:YES];
But the back button is still visible When i click it; it disappears... can any one help me hiding the back button for all the views in the tabbarC.
In your first view that will appear when you push to your tabbarviewcontroller set this
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.tabBarController.navigationItem.hidesBackButton=YES;
}
In viewDidLoad of ViewC do this:
[self.navigationController.navigationItem setHidesBackButton:YES];
Also tab selected view controller's viewWillAppear method
[self.navigationController.navigationItem setHidesBackButton:YES];
In your view just write this line..it will hide back button .. tested
-(void)viewWillAppear:(BOOL)animated
{
[self.navigationItem setHidesBackButton:YES];
}
How to navigation to previous page!
I add navigation controller to appDelegate so thought out the application i do have navigation controller.
I hidden navigation Bar and added HeaderView on the top.
// Hidden NavigationBar
- (void) viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
Now customize my header bar with UIView! I hidden navigation Bar and added HeaderView on the top.
Now i added BackButton to the header Bar. Now i want to navigation pervious page. Can any one suggest me?
#Thanks In Advance.
if the view is called by a push action, call :
[self.navigationController popViewControllerAnimated:YES];
else if the view is displaying by a modal call :
[self dismissModalViewControllerAnimated:YES];
Use [self.navigationController popviewControllerAnimated :YES];
Use this when the user taps the Back button:
[self popViewControllerAnimated:YES];
#
I have two view named FirstView and Second View. Now I have one button in SecondView. If i click this button then i want to move FirstView. What is the code for it?
I don't want Navigation Bar.
And My button should work as a "Back" Button.
#
You could still use a UINavigationController, but hiding the navigation bar with calling
[self.navigationController setNavigationBarHidden:true animated:false];
in the second view's viewDidLoad method.
Then just show the second view by pushing it on the navigation stack in the first view:
[self.navigationController pushViewController:secondViewController animated:true];
and pop it from the stack when your button is pressed in the second view:
[self.navigationController popViewControllerAnimated:true];
Add SecondView as subview of FirstView. To go back, in the action method of back button, you could remove it from parent view.
In firstView :
[self addSubview:secondView];
In secondView :
- (IBAction)backButtonClicked:(id)sender {
[self removeFromSuperview];
}
I've been wandering how to hide / remove / disable only the main or first navigation bar in the navigation controller so that I could put an image as a whole background screen but I couldn't find any solution.
Did try hide the titleview in viewdidLoad of the main navigation controller but didn't work. Tried using navigationBarHidden but it hides the whole navigation bar for the next stack of controller.
So, I'm not sure how to do this. To give you an example, I would like to have something like this app - The Masters Golf Tournament - http://appshopper.com/sports/the-masters-golf-tournament.
If you look at Screen 1, it doesn't have any nav bar at the top but when you touch any options it will push to a new view controller and have the nav bar appear as in Screen 3,4 and 5.
Hope anyone could help me with this.Thanks a lot!
In most of my applications I have a custom UIViewController class that I derive all other custom controllers from. In some of these, I added a method like navigationBarInitiallyHidden to the base class that other classes can override. The default result depends on the nature of the application.
In the delegate of the navigation controller, when a controller is being shown that implements that method, the delegate hides or shows the navigation controller accordingly. Since I animate the hide or show, I check the current state and do nothing if no change is needed.
You could do something simpler in your delegate method. If the controller being shown is the root controller, hide the navigation bar, otherwise show it if it is hidden.
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if ( viewController == rootController ) {
[navigationController setNavigationBarHidden:YES animated:animated];
} else if ( [navigationController isNavigationBarHidden] ) {
[navigationController setNavigationBarHidden:NO animated:animated];
}
}
You can hide the navigation bar:
[self.navigationController setNavigationBarHidden:YES];
and where you want to show the navigation bar again
[self.navigationController setNavigationBarHidden:NO];
hide/disable
self.navigationController.navigationBarHidden = YES;
show/Enable
self.navigationController.navigationBarHidden = NO;
You can hide navigation bar by using bellow code. Below code will hide navigationbar at the time of viewWillAppear.
Objective C
-(void)viewWillAppear:(BOOL)animated
{
[[self navigationController] setNavigationBarHidden:YES animated:NO];
}
Swift
self.navigationController?.setNavigationBarHidden(true, animated: animated)