AppDelegate, rootViewController and presentViewController

前端 未结 6 2109
南方客
南方客 2020-11-27 15:38

I\'m doing the Facebook integration tutorial, I want to show my MainViewViewController if the user has a valid token for the current state otherwise I want to show LoginView

6条回答
  •  醉话见心
    2020-11-27 16:31

    In Swift 3 :-

    let storyboard = UIStoryboard(name: "Login", bundle: nil)
    let viewController = storyboard.instantiateViewController(withIdentifier: "LoginViewController")
    window?.makeKeyAndVisible()
    window?.rootViewController?.present(viewController, animated: true, completion: nil)
    

提交回复
热议问题