How to dynamically populate Tab Bar controller's tab bars.? (in swift — iOS 9)

前端 未结 2 714
失恋的感觉
失恋的感觉 2021-02-06 15:07

I am developing an iOS application where the entry point is a login Screen. Which then after the login, segue to a tab bar controller. Now I want to dynamically populate the num

2条回答
  •  既然无缘
    2021-02-06 15:40

    I would suggest following schema:

    Whenever user logins with level 1 access - you need to save level1 value for this user in NSUserDefaults.

    Whenever user logins with level 2 access - you need to save level2 value for this user in NSUserDefaults.

    After that, when you are performing a segue to tabs controller, you need to check which value is stored in NSUserDefaults and display appropriate tabs.

    Just don't forget to remove values if user log outs.

    Also, I'm sure there is a better way to do this, but this is the first what came to my mind. Cheers.

提交回复
热议问题