I have a UITabBarController inside of a UINavigationController which originally had the navbar hidden before the view when the tabs were needed, though when I try to show the navbar inside the file nothing happens and if I do it just before the transition then it appears before I have pushed between the two controllers is there a way to stop this effect and make it so that when the next ViewController loads the navbar is on it when it appears?
This is not an OS specific issue as it occurs in iOS 6 and 7
The UITabBarController class is not designed to be used as a child of a UINavigationController, which might explain why you're seeing odd behaviour. If you absolutely need a tab bar within a UINavigationController, you'll probably have to roll your own. Otherwise, make your UITabBarController the window's root view controller and populate it with navigation controllers.
Managed to work it out though gave conmulligan the credit because he gave me the idea which was to keep the navigation bar hidden and to embed the viewcontroller inside a new navigationcontroller so there was a whole new navbar
Related
I'm presenting a UITableView modally to provide access to some application settings. When the modal view (root view controller) appears, it has a navigation bar like I expect. However, when one of the options is selected and the next 'UITableView` is popped to the top of the stack, there's no navigation bar.
Here's what one of the child UITableViews looks like:
As far as I know, the two children views should have navigation bars without me having to do anything because they're embedded in a UINavigationController.
I tried dragging a navigation bar to the views but IB will only let me put them inside the UITableView and if I do that, they do appear, but they also go too high in the view and run into the status bar and I can set any layout constraints on them to fix this.
I've scoured the Apple documentation with no luck and found many thread on SO that very, very old and in objective-C.
Can I make these views work together like I'd expect them to or am I going to have to build the child views from scratch?
UPDATE: I'm still trying to get this to work. I've now tried to create a new view controller from scratch. Here's what the view hierarchy looks like:
And you can see in the Storyboard something's not right:
And when I run this in the simulator, I get a new error:
"[UITableViewController loadView] instantiated view controller with identifier "UIViewController-cDg-wV-aMN" from storyboard "Main", but didn't get a UITableView.' But I created the segue by Ctrl-dragging from the cell in the root VC directly to the Table View.
To sum this all up, here's the flow I'm trying to achieve: UIViewController (initial VC) -> UINavigationController (presented modally from the bottom) -> UITableViewController (presented from right to left and with standard navigation bar).
My segues are all set to Show (e.g. Push)
Any help or suggestions would really be appreciated.
Well, I figured out how to fix the problem I was having after coming across another thread that wasn't about the same problem, but it had some advice that tipped me off.
The problem was caused by me creating the segues from the UITableViewCell on my Settings view controller to each of the child UITableViewControllers.
To fix the problem, I simply created the segues between the Settings UITableViewController and each of the child UITableViewControllers.
Hope this helps somebody else someday.
I've looked around and been unable to find a clear example/explanation of how to do this. I've just started with swift, apologies if any terminology is off.
What I'm looking to do is add a NavigationController to one of my TabBarItems in a way that I can view multiple views from utilizing the NavigationController while still staying within that TabBarItem view
So far I have the TabBar created, with three items. I don't mind doing it in either storyboard or programatically.
In the storyboard give each page view controller it's own navigation controller and make the navigation controllers the view controllers pointed to by the tab bar controller.
Do it like so:
https://stackoverflow.com/a/26153273/1527064
I have a UITabBarController to whose controllers I would like to attach navigation. So I inserted the NavigationController as the entry controller, and the tabBarController as its root. All seems working fine, but for the tabBar. Basically it does not show, albeit the StoryBoard I attach seems to say differently. I also attach the Account Screen not showing any navigation bar nor, of course, any back button.
Thanks,
Fabrizio
Just a quick answer. I think you should put UINavigationController inside the TabBarController instead of the other way round. It will solve most of your problems.
Steps: Editor -> Embed in -> Navigation Controller
See the below screen shot on how to add a Navigation Controller to a View Controller.
You are following wrong approach, IOS does not allow you to use tabbarview controller as root of navigation controller, it always display black screen. I have faced same problem and as a solution i have added navigation bar after tabbar controller. Yes it becomes difficult to manage, but you can use that way and it will work.
If you use programmatic approach instead of storyboard then it is possible, see this link
Even you can try from Editor option of XCODE, select tabbar controller you have added from storyboad then go to Editor->Embedded in, you will see that navigation bar controller is disable.
This is also give you idea that it will not work.
I've tried a lot to get this done.I don't want want to use addsubview or uitabbarcontroller. I want to switch the view when I tap on different tabs and tabbar should stay there. Thanks a lot in advance.I m a newbie.I want to use uitabbar not uitabbarcontroller.
A simple approach would be to wrap the view controllers you are inserting in UITabBarController in a UINavigationController then you can simply push your new view to that UINavigationController and the tab bar would be always visible!
For more details refer Apple Docs
Edit:
If you don't want to use UITabBarController then you need to do 2 things:
Add the tab bar View to UIWindow that way it would be always visible.
Scale/adjust the views in your view controllers to leave space for the tab bar
I enabled o UITabView on the bottom of the screen, and that works, but the rest of my buttons on the app screen suddenly stopped working. Would anyone know why that might happen? I was using push segueys for them.
I think the issue may be that originally I have a NavigationController that I use on the app, and then the UITabBar controller interferes with it.
Thanks!
As per Apple recommendation, UITabBarController should only be the root controller of an app. I think what you are doing is you are having the UITabBarController nested in your UINavigationController, and that won't work.
You can instead select your navigation controller and embed it in a UITabBarController. (I don't have XCode with me now, but I think there's an option in the menu called Embed in -> Tab Bar Controller. You can search for it in Help.)
(If you need the tab bar controller to be nested under nav controller, I believe you need to use some buttons to fake its effect.)
If you only need a tab bar but not tabbar controller, then don't use tabbar controller.