How to present ModalViewController in iOS app with TabBarController? -
i looking feedback on best practice approach when want nowadays loginviewcontroller "modalviewcontroller" in app tabbarcontroller.
the case this: - application supports user sessions login/logout functionality - when app launched tries login automaticly , either display tabbarcontroller straight or loginviewcontroller (displayed modalviewcontroller enable dismiss animation on login) - application has tabbarcontroller number of tabs. - each time viewcontroller presented user's state checked - if user isn't logged in modalviewcontroller login functionality should presented - if user manually logout same modalviewcontroller should presented
i have tried come several different designs handle , no 1 feels "correct". have worked on 1 project handled using subclassed uiwindow replaced apps default uiwindow. subclass listened different notifications such "userloggedinsuccessfully", "userloggedout" etc, handle presentation of modalviewcontroller.
are there other solutions this? appreciate input , experiences of kind of solution.
there different solutions problem , seek these alternatives first 1 recommended approach say,
you can create homeviewcontroller first tab of tabbarcontroller default open every time, , create loginviewcontroller separately, in appdelegate check login session in didfinishlaunchingwithoptions , if session not valid show loginviewcontroller modalviewcontroller otherwise show tabbarcontroller tabs included.
alternative have controllers in tab when nowadays loginviewcontroller , after user has signed in, add together controllers in mutbalearray , delete current object loginviewcontroller. 1 time user signed in , save info in keychain , way user not have login 1 time again , again, way can avoid showing loginviewcontroller every time, 1 time user tries log out , add together loginviewcontroller in array , add together tabbarcontroller objects after loginviewcontroller.
ios modalviewcontroller uiwindow
No comments:
Post a Comment