I want make a typical tabbar based application.
And I want to insert login view on startup before main tabbar is shown.
I tried to insert TabbarController in main view, but cannot find appropriate code. All sample code I found is insert TabbarController on startup. (in Delegate file)
My fellow suggest create toolbar on startup but hide it at login view, but I am not sure if this is a general method or not.
In this case, what is a 'recommanded' handling method of TabbarController ?
A simple solution would be to
1-Add the tab bar to UIWindow in the appDelegate as is suggested by apple.
2-then add a UINavigationController in tabbar using tabbarController.viewControllers=[NSArray arrayWithObject:yourNavController];
3- Now after alloc init on your login controller write this code before pushing it to the navigation controller of the tabbar
yourLoginController.hidesBottomBarWhenPushed=true;
4- push yourloginViewController to the navigation controller of the tabbar.
5- After authentication before pushing your MainviewController instance on the navigation set it like this
MainviewController .hidesBottomBarWhenPushed=false;
I hope these five simple steps will do the magic for you cheers :)
Please let me know if it helps you.Thanks
The approach I use for login screens which works great is:
prepare and show the regular main screen (tab bar controller with whatever initial VC you want to use)
immediately present the login screen modally (without animation) from the tab bar controller (which will obscure the tab bar controller, which is what you want)
make the login screen the startup image
Related
Attached are two images. The first shows my current main.storyboard, and the second shows my problem when I run the app. I have a tab bar controller that has two tabs. On the first tab there is a button. When pressed, the button goes to another view controller with content. At the top is a Navigation bar with a back button. After viewing content, I press the back button, and am back on the original page with the button, but the tab bar is missing. I have seen a few answered questions, but it appears they made their tab bar in the view controller instead of the storyboard. Another says that I should never return to a previous view unless I use an unwind segue. Is this true? If so, how do I set up an unwind segue. If not, how do I fix this problem otherwise? Thank you.
http://i.stack.imgur.com/IYmX2.png
http://i.stack.imgur.com/7slt5.png
The problem is in the wiring of your ViewControllers. You have probably embedded your UITabBarController inside the UINavigationController and not the other way around.
A correct layout looks like this in Interface Builder :
To reproduce:
In Interface Builder drop a UITabBarController. This will come with 2 UIViewController's already wired in.
Pick one of the UIViewController's (let's call it VController1) and click on Editor / Embed in / Navigation Controller. This wires the VController1 to live inside a UINavigationController that is inside the UITabBarController
Add a 3rd UIViewController next to VController1 Let's call it VController3
Wire in a segue between VController1 and VController3, for example with a button.
I hope that's clear enough
Try Linking the button in your viewcontroller (other than the views of the tabbed bar controller) with the tabbed bar controller. Create a segue that links the button with the controller of the tabbed bar application
I'm trying to develop a tab bar controller application with four UIViewControllers. I have already programed my app. Now I need to add Login in my App. I have added a separate UIViewcontroller for login (Which is not part of TabbarController). Login is working fine. How can I load UITabbarcontroller after login is success.
A solution to this is to create a UINavigationController to house the login view and when a login is complete you push the UITabViewController onto the Navigation Controller. It works well and you can just hide the navigation bar so the user doesn't just jump back to login(unless you want this).
You could also just swap out the rootviewcontroller of the window but I like the navigation controller solution better and you can easily popToRootViewController to go back to login when you want.
I've tried many different ways but can't get it to work. How can I make a simple login/logout view/app? I need the initial page to be a regular UITableView, once login button is pressed it should (push/addsubview ?) to a new UITabBarView (with 2 UITableViews in that), on the second tab exists a logout button, which should send you back to initial login page, also on the login page the nav controller and tabbar should never show up, (but I think I can figure that out). I tried pushing and popping viewcontrollers put that's getting messy. Xcode 4.1
Examples or help will keep me from pulling the little hair I have left out!
Thank You!
I 've wrote some thing, may be it took complex to understand by you but i've tried to explain, main theme is that to make a navigation controller and set it to app delegate window's root view controller then push login view controller to it, and then pushing tabbar controller, read below some explanation.
this is mostly done by making a navigation controller and setting it the app delegate window's root view controller, then make a view controller that is your login view and setting it the root view controller to app delegate's navigation controller, then make a tabbar controller (a view controller) which contains tabbar and navigation controllers on each tabbaritem, and furhter each navigation controller has a reference to tabbar controller(the view controller pushed at login time). So, whenever logins is pressed, it pushes the tabbarcontroller and performs tasks. and when you want to logout, just pop to root view controller of the referenc's navigation controller which in fact is the login view controller.
You can hide tabbar, then show it after login success.
https://github.com/idevsoftware/Cocoa-Touch-Additions/tree/master/UITabBarController_setHidden
I have navigation controller based project. In my project I have Splash Screen & Login Screen where i have hidden the navigation controller.
Now i have to implement TabbarController in the application and It need to be shown the screen after Login Page.
I want to add it in AppDelegate.But my problem is that I have set rootviewcontroller of Window as navigation controller.
And Now i want to use Tabbar controller also into the Appdelegate class.
I am finding difficulty into it.
Any help will be appreciated a lot.
What you can do is set the rootviewcontroller as a tabbarcontroller and add a tab for your login screen but make sure to hide the tabbar initially, after the user login, you can remove the tab programatically and show the tabbar.
Maybe you really need that kind of navigation in your application, to me it sounds a bit of a unnecessary workaround and against guidelines. Try having a look at Apple's ("View Controller Programming Guide > Combined View Controller Interfaces") and maybe you'll find a more elegant solution to your problem.
I am trying to write an iPhone app that has both a UITabBar controller (and its associated views) and a plain vanilla view controller that is not part of the TabBar (i.e. an initial config page that only gets displayed the first time the app is run).
I am able to put a Tab Bar Controller and a View Controller in MainWindow.xib and shuffle between the two in the app delegate.
While this works I'm wondering if this is the best way to be implementing this.
It doesn't feel very "MVC-ish" to me but I think the two different controllers both need to be root (?)
I don't know how else I would do it.
If the config page is really only a "run once" affair, you could just pop it as a modal view from within the tab bar controller via the presentModalViewController:animated: method. (If on the other hand the config page is ever likely to be required in the future, I'd just add it as another option on the UITabBar.)
You would make the tabbarcontroller the default view. And present the viewcontroller modally in viewWillAppear or similar method. Then when you want to switch to the tabbar, you'd dismiss the modal view controller.