我怎样才能调用不同的TabBar项目相同的ViewController?
-
26-09-2019 - |
题
我已经是,根据输入的参数示出了不同的数据开发了一种视图控制器;我想在其中加入不同的参数使用的TabBar接口并调用同一个视图控制器从不同的选项卡。 我能做到这一点?其实我得到的错误,如果我的TabBar项指定的ViewController的NIB。
你能帮助我吗? 提前致谢 角
解决方案
创建的ViewController的两个不同的实例:
MyViewController *vc1 = [[MyViewController alloc] initWithNib:@"MyViewController" bundle:nil];
MyViewController *vc2 = [[MyViewController alloc] initWithNib:@"MyViewController" bundle:nil];
UITabBarController *tabs = [[UITabBarController alloc] init];
[tabs setViewControllers:[NSArray arrayWithObjects:vc1, vc2, nil] animated:NO];
不隶属于 StackOverflow