Go to custom tab in UITabBarController - swift

I have an app with the first screen being a login screen. Once the user has logged in, it segues to my tab bar controller with 5 tabs but at the moment it always opens the first tab by default.
How do I get it to open the 3-rd tab? I've done it before in AppDelegate but that was for an app with the starting screen being the tab bar view, but it doesn't seem to work when it's not.
Swift 3, iOS 10.3, Xcode 8.3 Beta 2

In your UITabBarController's viewWillAppear do
selectedIndex = 2

Related

Xcode app, navigation bar not showing on iPhone 6

I have an app that has been out for some time. I recently updated it to Swift. I have one user who is seeing different results than I am on either the simulator or on two different devices. The view presented is for video playing and on my devices and the simulator the navigation bar is present and the control bar for the video, unless the screen is tapped to dismiss it. On my user's iPhone 6 there is no navigation and no control bar.
I have not called for the navigation bar to be hidden on that view.
Haas anyone any ideas on what is happening?

Need an ideal way to handle tab bar in app

I want to create an app where there is a login screen, and when user logs in open up home page with tab bar controller.
I have created a single view application and have created login screen, home screen and a tab bar on it.
In tab bar delegate, I am adding screens to tab bar by [self.view addSubView firstView.view]
My problem is if I open up 4th tab, and switch to 2nd tab and I have to go back to home screen, so I press home btw on nav bar, it shows view 4 which is already on stack of uiviews.
How do I switch between all tab bar views and add navigation to them ? Which ideal method is to be used?
I've created app that is doing what you need (I guess). You can find it in app store for iphone using name Torchoo. It is free and there is test account so you can see how it works and if its really what you need. If yes, ping me here I will show you the sources and how I did it.
In couple of words, you need normal tabbar controller that has number of navigation controllers and each of them has number of view controllers. And login screen is just a modal view that shows/hides when you need it. Most of things may be done in storyboard.
I don't get it actually but i think you want to attach all the view by navigation controller.
But it's useless. if you want to use navigation bar then it ll navigate in another view but tabbar will give you different views on every tab.
so, first see the use of both of them then ask....

Hide a Tab bar Item in Xcode 4

I have a tab bar controller with a logginViewController, and I want to hide the tab bar item related to logginViewController and show a different tab bar item with a different ViewController
I'm working using Storyboard in a tab bar based app for iPhone
I've tried this solution but it doesn't work (Xcode don't allow me to use the "hide" option)
Please, any help on how I can do it in Xcode 4 will be great!
Thank you all
I like to suppose, that you subclass your TabBarController.
Via Protocol/Delegate you're able to work with data from your loggingViewController (maybe, a button get's clicked to hide the TabBarItem).
Implement that protocol to your TabBarController and so you're able to receive those protocol-methods to add/hide/delete the Items easily.
Try it out! Or further questions?

Is is possible to add a 5th tab bar button instead of "More" Button?

I'm working on an iphone application that has exactly 5 tab bar buttons.
I've created a custom tab bar and added 5 buttons to it, each with a separate view controller.
The buttons are showing fine, but the 5th view controller is not loading on 5th tab bar button press. This might be because the 5th button is supposed to be the "More" button. Is their some way to override it?
No the more button wil only show if you have more then 5 viewcontroller in the tabbarcontroller.
You can customize your tab bar to do so.
There're some exist ones, like the one below:
https://github.com/boctor/idev-recipes/tree/master/CustomTabBar
It works Excelent! And you'll see the screenshot that it use five tabs. :)
AS per apple human interface guidelines if you have more than 4 tabs last tab is displayed as more tab and you can not alter it

Iphone 3.0 More tab - not displaying when run in simulator

I have 5 views contained in my TabBarController, each view has a navigationController inside of it (Did this all through IB) and for some reason instead of the more tab displaying the 5th tab is shown. I have double-checked that all my nibs are declared and connections are created correctly in IB. In fact, all the views show when i click on the tab even the 5th. Anyone have any ideas?
Apple has apparently decided that 5 tabs is the most that should be visible at one time in the UITabBar. If you have 5 or fewer, it just shows them all; thus the MORE tab is not needed, and will not be visible.
Ok, so I got it,pretty strange..as soon as i put a sixth view controller under the tabbarcontroller the more tab shows up.Weird...
could have sworn that in the latest docs it still says more than 4...maybe I misread something...