且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在导航控制器 SWIFT 中显示视图控制器

更新时间:2022-11-08 09:30:27

导航控制器是否在故事板中?如果是这样,给它一个故事板 ID 并用导航控制器替换你的 matchesTVC 内容.

Is the navigation controller in the storyboard? If so, give it a storyboard ID and replace your matchesTVC stuff with the navigation controller.

如果matches是故事板中的一个独立的视图控制器,你可以用这样的代码来实现:

If matches is a standalone view controller in the storyboard, you can do it in code like this:

let matchesTVC: Matches = self.storyboard?.instantiateViewControllerWithIdentifier("Matches") as! Matches 
let navContr = UINavigationController(rootViewController:matchesTVC)
self.presentViewController(navContr, animated: true, completion: nil)