如何使用swift移动到另一个UINavigationViewController?

时间:2015-05-21 17:04:55

标签: ios swift uinavigationcontroller uinavigationbar

如何以编程方式转换到另一个UINavigationViewcController,以便有一个后退按钮转到上一个屏幕。我尝试使用此代码,但它只是模型。

 let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)

        let resultViewController = storyBoard.instantiateViewControllerWithIdentifier("NavViewController") as FirstMemberViewController

        self.presentViewController(resultViewController, animated:true, completion:nil)    

2 个答案:

答案 0 :(得分:0)

试试这个

// Your controllers
let navigationController = UINavigationController()
let viewController = UIViewController()

// The push
navigationController.pushViewController(viewController, animated: true)

答案 1 :(得分:0)

我找到了答案......

navigationController!.pushViewController(storyboard!.instantiateViewControllerWithIdentifier("Home") as! UIViewController, animated: true)