OGeek|极客世界-中国程序员成长平台

标题: ios - segue 后导航栏不见了 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:57
标题: ios - segue 后导航栏不见了

我有一个表格 View Controller ,其中我有一个附加到标题的搜索栏。

tableView.tableHeaderView = searchController?.searchBar

当我在搜索栏中输入单词时,我的帖子会从 Firebase 中检索出来并显示在另一个名为 segueTableViewController 的表中

 let locationSearchTable = UIStoryboard(name: "MainPage", bundle: nil).instantiateViewController(withIdentifier: "SegueTableViewController") as! SegueTableViewController
        searchController = UISearchController(searchResultsController: locationSearchTable)
        searchController?.searchResultsUpdater = locationSearchTable

当我单击 segueTableViewController 中的单元格时,它会将我转到详细页面,但此页面没有导航栏。但是,当我从另一个页面转到详细页面时,它有一个导航栏。几个月来我一直试图找出原因,但我做不到。 enter image description here

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "GOTOPOST" {

            if let IndexPaths = self.followUsersTableView.indexPathForSelectedRow {

                self.navigationController?.isNavigationBarHidden = false

                let vc = segue.destination as! BookDetailsViewController
}}}



Best Answer-推荐答案


请添加 Storyboard关系(显示)。并且 Storyboard 添加标识符值“SegueTableViewController”。导航 Controller 应该在搜索 Storyboard引用中

enter image description here

关于ios - segue 后导航栏不见了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46675713/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4