我想使用具有登录窗口和标签栏 Controller 的 Storyboard创建一个应用。
因此流程将在点击登录按钮时进行,应用程序将被重定向到带有其 View 的标签栏 Controller 。
我这样做了:
但引用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 会执行任何操作。
这是一个示例布局:
委托(delegate)协议(protocol)如下所示:
@protocol LoginViewControllerDelegate
-(void)finishedLoadingUserInfo:(UserInfo *)curUser;
@end
UserInfo
是我用于用户信息的模型(在我的例子中是 NetworkID、FullName 等)。
当用户成功通过身份验证后,我将触发在呈现它的类中处理的委托(delegate)方法。如果您需要更多详细信息,我可以提供帮助 - 但过程很简单。
关于ios - 关于使用 Storyboard的标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13354591/