本文介绍了如何从初始UIViewController导航到Swift中的UISplitViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 AllVisible 模式下的 UISplitViewController 中显示我的详细信息。但是,在那之前, loginViewController 就在那里。用户应该登录,然后它将导航 UISplitViewController。我不知道如何导航到该viewController。我在我的应用程序中没有使用任何 UINavigationController 。我尝试了一些东西,但失败了。 ?我使用以下代码:

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:

代码:

//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.

推荐答案

你做错了什么。我的代码没有问题,如果密码正常,它会进入拆分视图。看看这个:

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:

故事板: 登录 - >拆分 - >(主人,详情)

登录 有一个按钮,一个开关和一个自己和拆分视图控制器之间的争论(标识符:'showsplit')

LoginViewController类:

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

    @IBAction func btn(sender: AnyObject) {
        if pass.on {
            performSegueWithIdentifier("showsplit", sender: self)
        }
    }
}

这篇关于如何从初始UIViewController导航到Swift中的UISplitViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 22:11