ios - UIWindow's rootViewController considerations -
i've been reading several posts dealing switching rootviewcontroller
of window, , said keeping same rootviewcontroller
throughout app's lifecycle better switching it, , other posts related changing rootviewcontroller
@ point of app. i'm confused this, , couldn't find recommendation regarding point in apple's docs.
what should best practice when have different content view controllers in app? example, let's have tabbed app (uitabbarcontroller
) want first show welcome view signing in or signing (uinavigationcontroller
):
1) approach fixed rootviewcontroller
. think should set uitabbarcontroller
rootviewcontroller
, core of app tabbed, if user credentials needed, set uinavigationcontroller
within uitabbarcontroller
, hiding tab bar, push welcome view , navigate sign in/sign view controllers.
2) approach switching rootviewcontroller
. firstly, if user credentials needed, set uinavigationcontroller
rootviewcontroller
show welcome view , navigate sign in/sign up, and, once user credentials provided or account created, switch rootviewcontroller
uitabbarcontroller
show core tabbed app.
in case best general approach switching rootviewcontroller
needed, memory management considerations you'd take account? should need have 2 strong
properties in appdelegate (uitabbarcontroller
, uinavigationcontroller
)? , transition between view controllers when switching rootviewcontroller
: smooth, or should animate it?
thanks in advance
the approach of switching rootviewcontroller suits . firstly, if user credentials needed, set uinavigationcontroller
rootviewcontroller show welcome view , navigate sign in/sign up, and, once user credentials provided or account created, switch rootviewcontroller uitabbarcontroller
show core tabbed app
if store user credentials inside tabbarcontroller . store them in nsuserdefaults
or plist
in main bundle or created in document directory .
Comments
Post a Comment