I'm facing this problem for a couple of months and i don't know what is the best solution to solve it.The problem is,i need to load a XIB before my UITabBar shows up,more clearly,i have my first view which is to the user login(NO TABBAR SHOULD BE DISPLAYED),when user login,the app verify the information and after should load the view with a UITabBarController,but every time i try do that without presenting the login view modally,both of the views are displayed,the login view and the tabbar view.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
As far as I know,
UITabBarController
can not to be embedded in anotherviewController
. With that in mind, you have these choices:Present a modal view (that you don't want)
Hide
tabBar
on launch, and once credentials are verified, show thetabBar
. But there is a downside: hiding/showingtabBar
can not be animated.You can initiate your
UITabBarController
with only oneviewController
- the one that is going to ask for credentials, and once verified, add moreviewControllers
to theUITabBarController
(that will add more tabs). This is also the kind of behavior you can see in some app, e.g. Bank of America (http://itunes.apple.com/us/app/bank-america-mobile-banking/id284847138?mt=8)There might be better practices. These are my suggestions.
You could set first the loginViewController as
rootViewController
of your mainwindow
, then after the user is logged in, set the tabBarController asrootViewController
.Something like this (assume your loginViewController is
viewController1
):Then from the loginViewController call the method
setTabBar
of the appDelegate.As an easy way, add your view as a subview of your window, and dismiss it when you don't need it anymore.
For example, put this code in your appdelegate (assuming
loginController
is a property of your appdelegate...there are other ways, this is just an example):When you want to dismiss the view, remove it:
Don't forget to properly release
loginController
.This way your view is just simply "overlayed" over your tabbar views. There are other answers here that effectively only swap the tabbar view into your view hierarchy after your login is complete, if that's what you want.