[英]UITabBarController custom class in storyboard doesn't work
I've set up a UITabBarController
in storyboard with 4 tabs, each linking to a UITableViewController
. 我在故事板上设置了UITabBarController
,其中有4个选项卡,每个选项卡都链接到UITableViewController
。 I've set the class of the UITabBarController
to my own custom class MyTabBarController
which is a subclass of UITabBarController
. 我已经将UITabBarController
的类设置为我自己的自定义类MyTabBarController
,它是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. 现在,我希望能够从MyTabBarController
类访问情节MyTabBarController
上已经存在的4个表视图控制器,以便可以将数据从一个传递到另一个。 I have no idea how to access them from this point, all I know how to do is @property (nonatomic, strong) MyTableViewController *tvc;
我不知道如何从这一点访问它们,我所知道的只是@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. 然后合成它,但这会创建一个新的MyTableViewController
对象,并且不会链接到故事板上已经MyTableViewController
对象。
I hope that makes sense, appreciate the help. 我希望这是有道理的,感谢您的帮助。
You inherit this property from UITabBarController
: 您可以从UITabBarController
继承此属性:
@property(nonatomic, copy) NSArray *viewControllers
You should be able to access its contents and identify which view controllers it knows about. 您应该能够访问其内容并确定它知道哪些视图控制器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.