Swift - Keeping tab bar displayed through out project - swift

I have seen many other questions very close to this one but couldn't find a solution for this precise case :
I have a tab-bar application, connected to 4 UIViewControllers. I'm trying to connect one of these 4 UIViewController to another UIViewController using a Show action segue and keeping my tab bar displayed.
I'm not embedding the 4 first UIViewControllers in UINavigationController.
Simulated metrics are set to inferred and "Hide bottom bar on push" is unchecked. Segue kind is set to "Show (e.g. Push)".
On my storyboard, the tab bar automatically appears at the bottom of the last created view when I add the segue. When building the project, the tab bar is visible only on the 4 UIViewControllers directly linked to the TabBarController. However, I lose it when the last view is showed.
How do I keep my tab bar displayed on this last view ?
Many thanks for your help !

Found this simple solution :
I have embedded the first ViewController in a Navigation Controller. As I didn't want to show a navigation bar in my header, I simply hid it in Viewdidload :
self.navigationController?.navigationBarHidden = true
Hope this will help someone !

Related

How i implemented an Tab into UITabBar without seeing this tab as item?

I have an UITabBarController which has 5 Tabs. So, my problem is, i want to make an welcome screen into the UITabBarController, but this screen should be just only one time visible, when the app started. After the screen appears and the user switch the Tabs, he can't go back to the welcome screen, otherwise he must quit the app and open it again.
I tried to make an UIViewController as an RootViewController, but he dont show me the UITabBarController instead.
Is there any way that i can solve this problem over the storyboard? Also with code it will be also okay.
If I did not misunderstand your question these ideas will help you;
Add an extra tab to your tabBarViewController , make it welcome view and make this view controller initial VC so user when landing to tabBarViewController this view will appear after few seconds change tab index selectedIndex as you desire from UITabBarViewController then hide welcome view button from tabBar.
Seond way : Inside UItabbarViewController create custom tabbarView (scrollable) you can use collectionView it's easy to implement and it cells selectable like buttons. Hide original tabbar make welcome view appears first, make its index sixth then change selectedIndex programmatically when you need and disable scrolling from collectionView with this way only your five buttons appears on screen and welcome view button automatically remain out of screen.
You can find example code in my Github repo UICWaveTabBar, UICSlideTabBar , UICExapandableTabBar
Fist link including .xib file, you can edit it from storyboard, second and third only code

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?

remember the last view in a tab inside a UITabViewController

I have a question that I tried to find an answer for the last four days without success. Any help would be greatly appreciated!
My design is in someway similar to the iphone "phone" app came with iPhone.
My root view controller is a UITabBarController. I have three UINavigationControllers controlled by this UITabBarViewController. Each UINavifationController pushes a number UIViewControllers in sequence.
My question is that if I clicked through the views in the first tab (e.g.: iphone "phone" favorites tab) to display a detail info (contact's detail info view). Now I switch to another tab (the "Recent" tab). When I click the first "Favorites" tab again, how do I make the "contact's detail info view" show up instead of the root view of the first tab (tableview list of "Favorites).
In another word, what is the way for the program to remember which "top" view (and the view stacks) for the other tabs. So when I click back to the tab, it will show the "top" view for me instead of the root view controlled by uinavigationviewcontroller?
Thanks for your help!
You shouldn't collide with this problem, since iPhone does what you want by default. I think the problem is either in the way you add the view controllers in the navigation controller, or in the way you create/store your navigation controller. Perhaps, you just erase the info you've just added somehow after you'd change a tab. Try to watch this video
http://youtube.com/watch?v=LBnPfAtswgw
it explains well step by step how to build the architecture you want with the help of interface builder.

Tabs under UITabBarController's More button have 2 navigation bars

I have 6 view controllers on a UITabBarController. Each of them has a UINavigationBar at the top of them (Not linked to a UINavigationController), for showing the title of that view controller, and some buttons for controlling it. This was fine while I had 5 controllers, as no 'More' button would appear, but when I add a 6th, the more button appears. The tabs under that end up having two UINavigationBars! One is the one I added, with my title, the other is created by the TabBar and has a 'Back' arrow to go back to the more page. How can I fix this, either by merging them or otherwise?
Thanks, if you want screenshots just ask.
Here's a screenshot
The brown one is a UINavigationBar subclass I made, and added to the view in IB. The other one was added by the Tab Bar controller.
Yes you will need to merge them.As you need more tabs so More controller will apear and once you navigate in, it will put back button(more). In order to solve this and maintain your brown navigationBar you will need to use navigationController for those tabs in more(only for extras, not for all). This will put more(the back button) on your navigationBar.
But Remember In more you will have edit option also using which user can change position of tabs. So in that case this problem may reappear for other controllers. So please check if you can disable the editing of tabs(rearrangement). If not then you should think the same for other controllers also(in other tabs)
Thanks,
Ok, Followed all of your tips but no luck, until: I tested this https://stackoverflow.com/a/3397506/468868
Basically, you are right #Ravin, we must wrap the items in NavigationControllers, but after that, you must specify that:
- (void)viewDidLoad
{
self.navigationController.navigationBarHidden = YES;
}
Now, I just need to figure it out how to remove the navigationController from the "More" view

Combining UITabBarController with UINavigationContoller

I am sure this is very simple, yet I am stuck...
I have created an application and added UITabViewController (dragged in from the library in Interface Builder. My application has 3 different views, clicking on appropriate tab brings the different view. So far so good.
I want to convert one of the views to be a UINavigationController: basically a table with the option to delete rows (so UINavigationController would need to have a button "Edit" on top).
I saw many samples which would do either 1 or 2, but not both.
How would I combine it, keeping in mind that I have used provided UITabViewController and did not added UITabBar directly to the view.
Thanks
If you are using Interface Builder, you should be able to just drag and drop a navigation controller into your tab bar controller as a child controller. The next tab bar item should be generated for it automatically from that.
You can also do this programatically by just creating however many UINavigationControllers you need in an array and assigning that to the uitabbarcontroller appropriately.
I actually don't like this method of combining the UINavigationController and UITabBarController since the tab bar controller must always be visible, which can be really confusing sometimes.
Instead, I recommend you make your own custom UITabBarController (Tab bar controller inside a navigation controller, or sharing a navigation root view) which you add to the navigation controller. I personally don't know why Apple didn't do this; hopefully this is the standard way in 4.0 :)