在UISideMenuNavigationController的TableViewController子项上设置导航项标题不起作用

时间:2017-08-16 18:23:14

标签: swift uinavigationitem

我正在尝试以编程方式为我的rootViewController设置标题,但它无效。

func configurarMenuRightNavigationController() {

        SideMenuManager.menuFadeStatusBar = false

        let menuRightNavigationController = storyboard!.instantiateViewController(withIdentifier: "RightMenuNavigationController") as! UISideMenuNavigationController

        //let menuRightNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
        // UISideMenuNavigationController is a subclass of UINavigationController, so do any additional configuration
        // of it here like setting its viewControllers. If you're using storyboards, you'll want to do something like:

        SideMenuManager.menuRightNavigationController = menuRightNavigationController

        SideMenuManager.menuRightNavigationController?.viewControllers[0].navigationItem.title = "Teste"

        SideMenuManager.menuPresentMode = .viewSlideOut
    }

标题不会改变。

当我在常规UINavigationController上尝试没有Side Menu的另一个项目时,它可以正常工作。

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

当我创建自定义UITableViewController并将其设置为故事板上的表视图控制器的视图控制器时,它工作正常。