将 UITabBar 添加到现有应用程序

发布于 2024-12-22 14:55:16 字数 175 浏览 2 评论 0原文

我已经完全开发了应用程序。我必须在应用程序中实现 UITabBar ,但不是在 appdelegate 中,而是在其他视图和应用程序中。我必须将它用于离开 Appdelegate & 的所有其他视图。 appdelegate 之后的第一个视图。

有人能告诉我最好的方法2吗?

任何帮助将不胜感激。

I have fully developed application. I have to implement UITabBar into the application, but not in appdelegate, but in some other view & I have to use it for all other views leaving Appdelegate & 1st view after appdelegate.

Can anybody tell me the best way 2 do it?

Any Help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黎歌 2024-12-29 14:55:16

您可以在这里使用活动视图控制器概念,只需从 UIApplication 获取活动视图控制器并执行操作即可。

You can use active view controller concept here, just fetch active view controller from UIApplication and perform the action.

2024-12-29 14:55:16

您只需要推送一个UITabBarController。例如,您可以执行类似

UITabBarController *tabController = [[UITabBarController alloc] init];

Controller1 *controller = [[Controller1 alloc] initWithNibName:@"Controller1" bundle:nil];

Controller2 *controller = [[Controller2 alloc] initWithNibName:@"Controller2" bundle:nil];

Controller3 *controller = [[Controller3 alloc] initWithNibName:@"Controller3" bundle:nil];

tabController.viewControllers = [NSArray arrayWithObjects:controller1,controller2,controller3,nil];

[controller1 release];
[controller2 release];
[controller3 release];

[self.navigationController pushViewController:tabController animated:YES];

检查参考的操作:UITabBarController

You just need to push a UITabBarController. For example you can do something like

UITabBarController *tabController = [[UITabBarController alloc] init];

Controller1 *controller = [[Controller1 alloc] initWithNibName:@"Controller1" bundle:nil];

Controller2 *controller = [[Controller2 alloc] initWithNibName:@"Controller2" bundle:nil];

Controller3 *controller = [[Controller3 alloc] initWithNibName:@"Controller3" bundle:nil];

tabController.viewControllers = [NSArray arrayWithObjects:controller1,controller2,controller3,nil];

[controller1 release];
[controller2 release];
[controller3 release];

[self.navigationController pushViewController:tabController animated:YES];

Check the reference: UITabBarController

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文