I am assigning my view controller to my tab right after I create it. Is it possible to select the view that will show after the tab is clicked?
For eg
//user clicks tab 1
if(hasMessages)
//show view A
else
//show view B
Yes, it is possible. You need to set a delegate for your tab controller:
This delegate needs to conform to the
UITabBarControllerDelegateprotocol.In your delegate, implement
tabBarController:didSelectViewController:and inside it, find out which view you want to present. Assuming your tab’s root view controller is a navigation controller, then the delegate method implementation would be something like this: