如何将UItabBarController添加为子视图 [英] how to add UItabBarController as a subview

查看:139
本文介绍了如何将UItabBarController添加为子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用xcode的模板创建了一个TabBar项目,并且我在mainwindow.xib中使用了tabbar。

I have made a TabBar project using xcode's templates and I have the tabbar in the mainwindow.xib ofcourse.

在用户登录应用程序后,我将其重定向到名为notifications的页面, [self presentModalViewController:controller animated:YES]; 但是tabbar没有显示。

once after the user logs into the app, I redirect them to a page called notifications, [self presentModalViewController:controller animated:YES]; but the tabbar doesnt show up.

现在如何在上面的代码中包含tabbar或从mainWindow.xib获取tabbar并显示一旦UIView加载了吗?

now how can I either include the tabbar in the code above or get the tabbar from mainWindow.xib and display it once the UIView is loaded?

谢谢

推荐答案

你的吗? '登录'视图显示TabBar?如果是这样,那是因为你的登录视图控制器是TabBar视图控制器的子节点。您的模态视图不显示TabBar,因为它的控制器不是TabBar视图控制器的子项。

Does your 'log in' view display the TabBar? If so, that's because your 'log in' view controller is a child of the TabBar view controller. Your modal view does not show the TabBar because it's controller is not a child of the TabBar view controller.

您可能想重新考虑应用程序的设计。模态视图控制器通常表示为与主工作流程的临时偏差。请参阅适用于iOS的View Controller编程指南 - 模态视图控制器

You may want to reconsider the design of you app. A modal view controller is usually presented as temporary deviation from the main workflow. See the View Controller Programming Guide for iOS - Modal View Controllers

你可以换掉东西。将应用程序的主要内容放在TabBar中,并在应用程序启动时,如果用户尚未登录,则将登录视图显示为模态视图。然后在用户登录后将其关闭。

You could swap things around. Have the main contents of your app in the TabBar, and upon the app launch, if the user is not already logged in, present your 'log in' view as a Modal View. Then dismiss it once the user logs in.

这篇关于如何将UItabBarController添加为子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆