【问题标题】:How can i call the same ViewController from different TabBar items?如何从不同的 TabBar 项目调用相同的 ViewController?
【发布时间】:2010-09-29 09:12:07
【问题描述】:

我开发了一个 ViewController,它根据输入参数显示不同的数据。我想使用tabBar 接口并通过将它们传递给不同的参数来从不同的选项卡调用相同的 ViewController。 我可以这样做吗?如果我在 tabBar 项目中指定 ViewController 的 NIB,则会出现错误。

你能帮帮我吗?
提前致谢。

【问题讨论】:

标签: iphone uitabbaritem


【解决方案1】:

创建两个不同的 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];

【讨论】:

    猜你喜欢
    • 2011-11-10
    • 2022-07-09
    • 2021-05-21
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多