presentViewController and displaying navigation bar

后端 未结 12 501
自闭症患者
自闭症患者 2020-12-07 13:27

I have a view controller hierarchy and the top-most controller is displayed as a modal and would like to know how to display the navigation bar when using

\         


        
12条回答
  •  臣服心动
    2020-12-07 14:13

    Swift version : This presents a ViewController which is embedded in a Navigation Controller.

        override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
    
        //  Identify the bundle by means of a class in that bundle.
        let storyboard = UIStoryboard(name: "Storyboard", bundle: NSBundle(forClass: SettingsViewController.self))
    
        // Instance of ViewController that is in the storyboard.
        let settingViewController = storyboard.instantiateViewControllerWithIdentifier("SettingsVC")
    
        let navController = UINavigationController(rootViewController: settingViewController)
    
        presentViewController(navController, animated: true, completion: nil)
    
    }
    

提交回复
热议问题