I do not think that those who answered βyesβ have read your question carefully enough. You asked if itβs possible to "get these three to view the same instance of the same view controller." Of course, you can use three different instances of the same subclass of UIViewController, but I donβt think you want to use the same instance.
I honestly have never tried this, but I would not logically expect it to work for several reasons:
The title and icon displayed for each tab is determined using the tabBarItem property of the view controller. If the same instance of UIViewController appeared several times in the viewControllers array of the tab bar controller, then each tab will also have the same tabBarItem, that is, you cannot give each tab a unique label and icon.
To save memory when switching from one tab to another, UIKit will unload the view of the disappeared view manager. If the view controller that you switched to is the same instance as the one that disappeared, UIKit may try to unload its view while it is being displayed. I expect this to create memory management errors that could cause your application to crash with the EXC_BAD_ACCESS signal.
Instead of using the same instance for multiple tabs, I would recommend one of the following options:
a. Use multiple instances of the same subclass of UIViewController and set properties to uniquely configure each instance.
C. Create a base subclass of UIViewController that implements those aspects that are common to all three tabs, and then create three subclasses of your base class that implement those aspects that are unique to each tab.
cduhn source share