以编程方式创建的Swift 3子类化uiviewcontroller

时间:2017-05-20 02:58:52

标签: swift uiviewcontroller subclass

我在菜单中有一个幻灯片,用于以编程方式创建UIViewController:

func showControllerForMenu(_ menus: Menu) {
    let menuChoiceViewController = UIViewController()
    menuChoiceViewController.view.backgroundColor = UIColor.white
    menuChoiceViewController.navigationItem.title = menus.name
    navigationController?.navigationBar.tintColor = UIColor.black
    navigationController?.navigationBar.titleTextAttributes =     [NSForegroundColorAttributeName: UIColor.black]
    navigationController?.pushViewController(menuChoiceViewController, animated: true)
}

这很好用,我想弄清楚的是如何子类化UIViewController以添加控件和功能。任何帮助将不胜感激。

0 个答案:

没有答案