How to remove/hide tabbar in tabbarconmtroller app? - objective-c

In my tabbarcontroller application having four bars, each tabbar having navigationcontroller inside viewcontroller. How should i hide for particular tabbar for particular tab in landscape orientation?.

To hide the TabBar when you push a new viewController to the navigation stack, simply add this code to the init method of that viewController:
self.hidesBottomBarWhenPushed = YES;

Related

tab bar style resets after presenting a modal with navigation controller

I want a transparent black theme throughout my iOS app on both navigation bars, tab bars, and toolbars (I use all 3), and I have this set up through storyboards. I have a subclassed tabbar controller that presents a sign up modal with a navigation controller programmatically as follows:
UserSignUpViewController *userSignUpViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"UserSignUpViewController"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:userSignUpViewController];
userSignUpViewController.delegate = self;
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil];
this is called in my subclass tabbars view did appear, so I can see that my tabbar shows up as translucent black before this animates up modally. when I dismiss this sign up navigation controller, the tabbar reverts to "opaque" meaning solid white. Why is this happening and how do I fix it?
The tab/navigation bar tint colors that I set in my appdelegate persist but the translucent styling of the bars gets reset for some reason. I should add that if I don't display the sign up view controller (user is already signed in), then the tab bar is the correct styling. Thanks!
It could be because you are calling it in viewDidAppear instead of viewDidLoad

How to hide the NavigationBar when i use SWRevealViewController embed in UINavigationController?

When i use SWRevealViewController as initial view or not embedded in UINavigationController the result is as i expected:
but when the SWRevealViewController comes from UINavigationController tee result is:
How can i avoid the NavigationBar presented in the Rear view?
Please add the following code to the viewWillAppear: method of the viewcontroller whose navigation bar you need to hide.
[super viewWillAppear:YES];
[self.navigationController.navigationBar setHidden:YES];
[self.navigationController.navigationBar.backItem setHidesBackButton:YES];
Try, this code for rear view controller
- (void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBar.hidden = YES;
}
If you really need Navigation Controller on top of SWRevealViewController:
You got to hide navigation bar from navigation controller of your SWRevealViewController.
U can do this in IB (assuming you are using Storyboards):
Select Navigation Controller in your Storyboard
Open Attributes inspector
Find section "Navigation Controller", uncheck "Shows Navigation Bar"
Next, If you want navigation bard in front view controller, then attach it to separate Navigation Controller. You will have two Navigation Controllers, think on which one you want to push - it will have different effect.

How to customize UINavigationBar with XIB?

UIViewController has a property called UINavigationItem.
So how can a UIViewController refer to UINavigationBar?
The UINavigationBar is not displayed yet till UIViewController is pushed into a UINavigationController. So it's not available in viewDidLoad.
So how do we customize it?
I added UINavigationBar to the XIB. However, how do I specify that I want to use THAT UINavigationBar rather than the one provided by UINavigationController?
I added UINavigationBar to the XIB. However, how do I specify that I
want to use THAT UINavigationBar rather than the one provided by
UINavigationController?
You don't. The navigation bar is the nav controller's responsibility -- your view controller doesn't get to swap in its own nav bar. Each view controller has a navigation item that it can set to customize simple things like title and buttons, and you can get the navigation controller's nav bar when the view controller is pushed onto the navigation stack using the controller's navigationController property.

How to open a modal with a navigation bar?

I am developing an iOS app using Rubymotion.
I am opening a modal and in this modal I want to use a viewcontroller but also a navigation controller which should be the rootViewController (right?).
Is the controller or the navigation controller rootview here?
This is my code:
controller = DetailsController.alloc.init
appsNavController = UINavigationController.alloc.initWithRootViewController(controller)
self.presentModalViewController(appsNavController, animated:true)
I get this message, donĀ“t know if it is related
Application windows are expected to have a root view controller at the end of application launch
I have a rootview controller in the app delegate
window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
window.makeKeyAndVisible
window.rootViewController = tabBarController
The problem is you are calling window.makeKeyAndVisible
when there is no rootviewcontroller.
Interchange the lines
window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
window.rootViewController = tabBarController
window.makeKeyAndVisible
This may help.
And make sure you have allocated tabBarController with valid viewControllers.

How to add a navigation bar to a UITableView

I added a subview to my application. The view controller is a UITableViewController. When I open the .xib file I see the table, but I can't drag a navigation bar onto it. So once the user enters the view, they have no way of getting back to the previous screen. What can be done?
the UITableView nib representation cannot have it. You can simulate the UI in the case you have a navigationController.
If you want to have a navigation controller, your UITableView has to be pushed into the stack of navigationController.
Assuming your view controller is ViewControllerA has a navigationController, then this method will make sure you have navigation controller in your UITableView:
[viewControllerA.navigationController pushViewController:tableViewController animated:YES];