ios - 关于使用 Storyboard的标签栏

标签 ios uitabbarcontroller uitabbar uistoryboard

我想使用具有登录窗口和标签栏 Controller 的 Storyboard创建一个应用。

因此流程将在点击登录按钮时进行,应用程序将被重定向到带有其 View 的标签栏 Controller 。

我这样做了: enter image description here

但引用Apple Documentation: UITabBarController

Because the UITabBarController class inherits from the UIViewController class, tab bar controllers have their own view that is accessible through the view property. When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller.

这意味着我不被允许这样做?

此外: 我的标签栏引用的3个 View ,然后每个 View 都有自己的 subview ,但是 subview 中的标签栏不见了。会发生什么?我错过了什么吗?

最佳答案

我在所有结构相似的应用程序中所做的是让第一个 View Controller 检查有效身份验证,如果失败,则显示登录 VC。该登录 VC 定义了一个委托(delegate),该委托(delegate)将在成功登录后传回用户凭据,然后关闭模态登录 VC 会执行任何操作。

这是一个示例布局: Layout

委托(delegate)协议(protocol)如下所示:

@protocol LoginViewControllerDelegate
    -(void)finishedLoadingUserInfo:(UserInfo *)curUser;
@end

UserInfo 是我用于用户信息的模型(在我的例子中是 NetworkID、FullName 等)。

当用户成功通过身份验证后,我将触发在呈现它的类中处理的委托(delegate)方法。如果您需要更多详细信息,我可以提供帮助 - 但过程很简单。

关于ios - 关于使用 Storyboard的标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13354591/

相关文章:

iphone - 可以滚动 UITabBar 吗?

swift - 应用加载后更改 TabBar 颜色

ios - UIWebView LoadFinished 事件在设备上崩溃但在模拟器上没有

ios - UICollectionView 没有出现在模拟器中

swift - 如何使用带有 UITabBarController 的 MVP 架构

ios - UITabBar 不改变色调 Xcode 9.3

iOS 7 - 禁用 UITabBarItem 色调颜色

iOS swift : extract a common method using type as input params?

ios - 如何在 Sprite Kit 场景外时删除节点

ios - 在基于 Storyboard的应用程序中禁用/启用 UITabBarController 中的选项卡