How to Navigate from Initial UIViewController to U

2019-07-08 19:19发布

I am showing my details in UISplitViewController in AllVisible mode. But, before that, loginViewController is there. User should login, then it will navigate UISplitViewController. I don't know how to navigate to that viewController. I am not using any UINavigationController inside my app. I have tried something, but failure. I used following code:

Code:

//ATTEMPT 1:
self.performSegueWithIdentifier("split", sender: self)

//ATTEMPT 2:
let leftVC = atlMasterVC()
let detailVC = atlDetailVC()
let splitViewController = splitVC()
splitViewController.viewControllers = [leftVC,detailVC]

//ATTEMPT 3
self.presentViewController(splitViewController, animated: true, completion: nil)
let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("split") as! splitVC
self.presentViewController(nextViewController, animated:true, completion:nil)

If I am any wrong, kindly guide me.

1条回答
祖国的老花朵
2楼-- · 2019-07-08 19:42

You are doing something wrong. I have no problem in my code and it goes to split view if the password is OK. Take a look at this:

Story Board: Login -> Split -> (Master, Detail)

enter image description here

Login Has A Button, A Switch And A Segue Between Itself And Split View Controller (identifier: 'showsplit')

LoginViewController Class:

class LoginViewController: UIViewController {
    @IBOutlet weak var pass: UISwitch!

    @IBAction func btn(sender: AnyObject) {
        if pass.on {
            performSegueWithIdentifier("showsplit", sender: self)
        }
    }
}
查看更多
登录 后发表回答