简体   繁体   中英

UITabBarController custom class in storyboard doesn't work

I've set up a UITabBarController in storyboard with 4 tabs, each linking to a UITableViewController . I've set the class of the UITabBarController to my own custom class MyTabBarController which is a subclass of UITabBarController .

Now I want to be able to access the 4 table view controllers that already exist on the storyboard from the MyTabBarController class so I can pass data from one to another. I have no idea how to access them from this point, all I know how to do is @property (nonatomic, strong) MyTableViewController *tvc; and then synthesising it, but that creates a new MyTableViewController object and doesn't link to the one already on the storyboard.

I hope that makes sense, appreciate the help.

You inherit this property from UITabBarController :

@property(nonatomic, copy) NSArray *viewControllers

You should be able to access its contents and identify which view controllers it knows about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM