打开UIViewController,不要显示UINavigationController导航栏

时间:2016-05-06 08:08:52

标签: ios objective-c iphone swift uinavigationcontroller

我的观点中有导航控制器。

enter image description here

在我的View Controller中有一个带有开关的didSelectRowAtIndexPath方法。在第一个单元格中,我想打开我的新视图“Empresa”,我使用它:

        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyboard.instantiateViewControllerWithIdentifier("Empresa")
        self.presentViewController(vc, animated: true, completion: nil)

工作,但不是apear导航控制器。像这样查看apear:

enter image description here

1 个答案:

答案 0 :(得分:5)

在这个地方

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

使用

self.navigationController?.pushViewController(vc, animated: true)

<强>更新

 let vc = self.storyboard?.instantiateViewControllerWithIdentifier("Empresa") as yourviewcontrollerName
  self.navigationController?.pushViewController(vc, animated: true)