开发者

How can i call the same ViewController from different TabBar items?

I've developed a ViewController that shows different data according to the input parameter. I would like to use a tabBar interface and call th开发者_StackOverflow社区e same ViewController from different tabs by passing them to different parameters. Can I do this? I get errors if I specify the ViewController's NIB in tabBar item.

Can you help me please?

Thanks in advance.


Create two different instances of your 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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜