正确初始化导航控制器swift

时间:2015-03-31 08:41:53

标签: swift uinavigationcontroller initialization

我有一个 viewcontroller ,我把它命名为SelectionPopUpViewController。我将该控制器嵌入UINavigationController

controller picture

SelectionPopUpViewController.swift,我说:

@IBAction func okTapped(sender: AnyObject) {
    self.dismissViewControllerAnimated(false, completion: nil)
    let homeVc = UIStoryboard(name: "Home", bundle: nil).instantiateViewControllerWithIdentifier("Home") as HomeViewController
    self.navController = UINavigationController(rootViewController: homeVc)
    self.window?.rootViewController = self.navController
    //self.navController.pushViewController(homeVc, animated: true)
}

在上面我说:

weak var window : UIWindow?
var navController : UINavigationController!

我想要的是当用户点击okTapped按钮时,它会转到HomeViewController。我尝试初始化,但它不起作用。也许我的初始化错了。

使该按钮有效的正确代码是什么(转到HomeViewController)?

0 个答案:

没有答案