re-initialise a uitabbarcontroller as tab bar items could have been removed for last user
I have an app that allows a user to login, based upon the users criteria I can remove specific ta开发者_JAVA百科bs that they (the user) have no use for. This is done behind the scenes while the user is loggin in and the tab bar is not yet visible. My question is, if this user logs out and another user logs in, how can i re-initialise the tab bar controller? at present if the new user has more tabs specific to them and I destroyed them for the last user the app crashes.
I have a total of 8 different tabs that can be removed and wanted the most efficient way of adding them back in after they where removed from the viewControllers array. I am aware i can just create new viewcontrollers and tab items and add them to the viewControllers array property but this will become long winded.
Adding back in previously destroyed viewControllers will likely be more long-winded than re-creating.
If I was you I would not have them created to start with and then destroy them. I would create the ones you want based upon the user login.
精彩评论