I have 5 tab in my tab bar controller. Users can use my application as anonymus user. One of my tabs is Login page. if user logged in my application, that tab should be Home page. but I don't know how set different view controller for one tab based on if condition
Asked
Active
Viewed 1,127 times
2
-
What issues are you facing? Please share your code so far. – Eeshwar Nov 10 '16 at 14:02
-
like I said I don't know where check my if condition and set different view controller for one tab – Saber Solooki Nov 10 '16 at 14:03
-
I write my app with swift. I search very lot in internet but can't find any like this issue – Saber Solooki Nov 10 '16 at 14:06
-
How are you setting your controllers to TabBar i.e. through storyboard or through code ? – Rajat Nov 10 '16 at 14:16
-
through storyboard – Saber Solooki Nov 10 '16 at 14:19
1 Answers
2
One of the possible solutions is to use container view controller. So, your view controller will have 2 embedded view controllers, and in code you can choose between them based on your logic.
There you can find some relevant examples and topics: https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html

Community
- 1
- 1

Pavel Gatilov
- 2,570
- 2
- 18
- 31