从导航控制器加载情节提要时,我需要执行segue。我在UpdatesViewController().segueToPerform("SegueIdentifier.forcedUpgrade")函数中使用viewDidLoad(),但它根本不会触发。

ios - 如何直接从 Storyboard 中的第一个导航 Controller 直接执行搜索?-LMLPHP

最佳答案

我不确定您使用的方法是否正确。

我如何加载其他ViewController是通过检查。例如,应用加载后,它将检查用户是否已登录;如果未登录,则它将按signin view controller

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    //forexample using firebase
    FIRAuth.auth()?.addAuthStateDidChangeListener({ (auth, user) in
        if let user = user {


        } else {

            // assign storyboard to the name of your storyboard
            let storyboard = UIStoryboard(name: "Main", bundle: nil)

            //instantiate whichever controller in the storyboard
            let signInViewController = storyboard.instantiateViewControllerWithIdentifier("SignIn")

            //present viewcontroller
            self.presentViewController(signInViewController, animated: true, completion: nil)

        }
    })



}

关于ios - 如何直接从 Storyboard 中的第一个导航 Controller 直接执行搜索?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37694998/

10-13 00:46