我有两个不同的故事板:
当用户未登录或注销时,应使用Loginstoryboard。然后应该对Mainstoryboard进行设置。
如何迅速实施?
期待您的回答! 一月
您是否尝试切换您rootViewController在application(_:didFinishLaunchingWithOptions:)
rootViewController
application(_:didFinishLaunchingWithOptions:)
假设Mainstoryboard您有rootViewController:
Mainstoryboard
if userIsNotLoggedIn { let storyboard = UIStoryboard(name: "Loginstoryboard", bundle: nil) let loginController = storyboard.instantiateViewControllerWithIdentifier("LoginNavigationController") as UINavigationController window?.rootViewController = loginController }
要在登录后切换视图控制器,您可以执行以下操作:
func loggedIn() { let storyboard = UIStoryboard(name: "Main", bundle: nil) let mainController = storyboard.instantiateViewControllerWithIdentifier("MainVC") as UIViewController let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate appDelegate.window?.rootViewController = mainController }