首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法隐藏导航工具栏

问无法隐藏导航工具栏
EN

Stack Overflow用户
提问于 2018-09-18 03:18:48
回答 2查看 225关注 0票数 0

其他解决办法似乎不起作用。

我正在使用一个MasterView应用程序,以防万一这很重要。

我希望在“detailViewController”上没有导航栏,也不希望在后续的ViewControllers上使用“Show”导航栏来实现。

下面是DetailViewController:

代码语言:javascript
复制
Class DetailViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.setToolbarHidden(true, animated: true)
configureView()
}

configureView() {
// Some UI Stuff
}


}

导航栏还在。

在MasterViewController中,这是prepareForSegue:

代码语言:javascript
复制
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "showDetail" {
        if let indexPath = tableView.indexPathForSelectedRow {


            if isFiltering() == true {
                let building = filteredBuildings[(tableView.indexPathForSelectedRow?.row)!]
                let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
                controller.detailBuilding = building
                controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
                controller.navigationItem.leftItemsSupplementBackButton = true
                rating = filteredBuildings[(tableView.indexPathForSelectedRow?.row)!].rating
                print("rating was changed to \(rating)")

            } else {
                let building = buildings[indexPath.row]
                let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
                controller.detailBuilding = building
                controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
                controller.navigationItem.leftItemsSupplementBackButton = true
                rating = buildings[indexPath.row].rating
                print("rating was changed to \(rating)")

            }




        }
    }
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-09-18 03:39:48

隐藏导航条工具栏不同于隐藏导航条本身。如果要隐藏工具栏,可以尝试@Anbu.karthik在注释中建议的内容。但是,如果您想要隐藏导航栏,则需要使用它。

代码语言:javascript
复制
navigationController?.setNavigationBarHidden(true, animated: true)
票数 2
EN

Stack Overflow用户

发布于 2018-09-18 03:58:37

self.navigationController?.setNavigationBarHidden(true,动画:真)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52378388

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档