I have a searchbar in my rearviewcontroller. When I click the "search" button, I want my frontView to change (to a searchViewController). The problem is, when i'm pushing with:
setFrontViewController:animated:
the navigationBar isn't showing anymore. I tried to show it with:
[[self navigationController] setNavigationBarHidden:NO];
But it doesn't change anything. I initialize all I need from the navigation bar in the viewDidLoad from the searchViewController. Anyone has an idea ?
Related
In my image, my first Tabbar is HomeViewController and the second Tabbar is CameraViewController.
What is the proper way to segue to the Tabbarcontroller? You can see the read line, I try to segue this but I
always get the back button in my HomeViewController and It display weird like not showing the navigation name.
In CameraViewController I hide the Tabbar for the use camera button. I try to use segue programmatically like this one.
[self performSegueWithIdentifier:#"sample" sender:sender]
but It doesn't work properly. Is this possible to segue to TabbarController?
You can't call
[self performSegueWithIdentifier:#"sample" sender:sender]
Because you're in TabBarController already. You could implement custom flow. By pressing "Back" button - just show TabBar and change selected tabBarItem for example…
update
used this
[self.tabBarController setSelectedIndex:0];
I'm a bit lost trying to figure it out...
I have a tab bar based app with login screen at the start. Login screen should be done as Modal View Controller BEFORE tab bar controller appears.
The problem is that I can present it only in viewDidAppear: method of TabBarController. And user can see for half a second content of the UITabBarController. I've tried to move call to viewDidLoad: or viewWillAppear: but it logs an error in console: "whose view is not in the window hierarchy!". As far as I can understand you can only add ModalViewController when all child UIViewControllers of UITabBarController are loaded, ad that happens in viewDidAppear: delegate method.
Do you have any solution how to show login screen without showing TabBarController before?
I've tried 2 ways of displaying ModalViewController, both of them work in viewDidAppear: only
XIB file with login view and using presentViewController: code
self.loginController = [[LoginViewController alloc] init];
[self presentViewController:self.loginController animated:NO completion:nil];
Storyboard, modal segue and calling it from the code:
[self performSegueWithIdentifier:#"loginScreen" sender:self];
Instead of a modal, you might consider pushing the login screen onto a navigation stack. Inside viewWillAppear: you can just instantiate your login viewController and push it. You could also do it in viewDidLoad if you'd like.
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController pushViewController:yourInstantiatedLoginViewController animated:NO];
}
I'm trying to achieve something similar to user of this post:
Xcode/iOS: How to hide Navigation- AND ToolBar on scroll down?
I'm able to hide (or unhide using NO) the navigation bar successfully using the code:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
However, when I attempt to hide the toolbar using the code:
[[self navigationController] setToolbarHidden:YES animated:YES];
Nothing happens. I then noticed when unhiding the toolbar that I received an additional blue toolbar that I didn't realize existed. This screenshot shows this:
Screenshot
I do not want the blue bar. What I am trying to do is hide or unhide the Black toolbar with the icons on it. (the UITabBar).
I think what I need to do is somehow I need to access the navigation controller of one of the parent view controllers and call the setToolbarHidden on the navigation controller of that view. However, I can't seem to figure out how to do this.
I've tried the following and all seem to have no effect:
[[[self parentViewController] navigationController] setToolbarHidden:YES animated:YES];
or
[[[[[[UIApplication sharedApplication] delegate] window] rootViewController] navigationController] setToolbarHidden:YES animated:YES];
My view controller storyboard consists of the following:
The InitialViewController is a TabBarViewController. It contains three children. One of those children is a UINavigationController. This navigation controller gets several UITableViewController pushed onto it, and eventually a UIViewController is pushed. This last UIViewController is what is seen in the screenshot.
Rough Layout:
TabBarViewController
UIViewController
UITableViewController
UINavigationController
UITableViewController
UITableViewController
UITableViewController
UIViewController
I've tried using
[self parentViewController] parentViewController] parentViewController] ...
to attempt to get back to the top, but this hasn't seemed to work either.
Any suggestions?
I think the problem here might be related to UITabBarController not having a UIToolbar. The setToolbarHidden: method will only apply to the UINavigationController's built-in toolbar (see Apple's documentation). If it's the UITabBarController's tab bar that you actually want to hide, take a look at this post which links to a method using UIView animations directly on the UITabBar.
Here's the deal... I can't get the UINavigation bar to appear on one of my views. I have the whole thing in a NavigationViewController in IB and turned of the navigation bar though IB because I don't want it in most of my app but when I try to show the navigation bar via code, it doesn't show up.
here's the code I used to try to get the nav bar to show up... but didn't work:
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self.navigationController setNavigationBarHidden:NO];
self.navigationController.navigationBarHidden = NO;
self.navigationController.navigationBar.hidden = NO;
Any help will be greatly appreciated
respectfully,
Matt
The code you write should only work inside of one of UINavigationController's controllers, not views.
So, if you call it from your view, you should replace self with controller name,in which this view is placed.
I am making an application that has a UITabBar and it works just fine, however I want to add a first screen which contains some instructions and a logo, then a button and when said button is pressed to show the UITabBar I've tried for a couple of days to do this on my own with no luck, I'm not even sure if it can be done, could anyone help me out? or give me a lead?
Try setting up the tab bar application, and then showing the first screen over it as a modalViewController. Inside your main app's viewController:
FirstViewController *firstViewController = [FirstViewController alloc] initWithNibName:#"FirstView" bundle:nil];
[self presentModalViewController:firstViewController animated:NO];
[firstViewController release];
When the button is pressed inside the modal view, call:
[[self parentViewController] dismissModalViewControllerAnimated:YES];
to get rid of it. You can adjust the animation style for the dismissal, or use NO instead to have it just disappear.