我整合了一个滑出侧栏菜单,如Venmo或groupme或facebook。我试图建立功能来更改根视图控制器,或者根据侧栏菜单中选定的单元格将主视图更改为新的视图控制器。
我被告知要查看具有此代码的viewdidload方法。
如何在这里添加新的视图控制器?换出" centerViewController"
覆盖func viewDidLoad(){ super.viewDidLoad()
centerViewController = UIStoryboard.centerViewController()
centerViewController.delegate = self
// wrap the centerViewController in a navigation controller, so we can push views to it
// and display bar button items in the navigation bar
centerNavigationController = UINavigationController(rootViewController: centerViewController)
view.addSubview(centerNavigationController.view)
addChildViewController(centerNavigationController)
centerNavigationController.didMoveToParentViewController(self)
let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: "handlePanGesture:")
centerNavigationController.view.addGestureRecognizer(panGestureRecognizer)
}