Ios 使用swift 3中的SWREAVE view cntroller从搜索页面导航回主页时,导航栏消失?

Ios 使用swift 3中的SWREAVE view cntroller从搜索页面导航回主页时,导航栏消失?,ios,swift3,uinavigationbar,swrevealviewcontroller,Ios,Swift3,Uinavigationbar,Swrevealviewcontroller,在这里,我在主页中有导航栏,即前视图控制器,在主页中,我在导航中有导航栏和搜索栏。点击搜索栏后,它会移动到没有任何导航的搜索页面,如果我退出搜索页面,主页导航消失,有人能帮助我如何放置导航栏吗从swift 3中的任何视图控制器返回时的主页 下面是我的图片 使用的代码如下所示 func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) { let storyboard = UIStoryboard(name: "Main", b

在这里,我在主页中有导航栏,即前视图控制器,在主页中,我在导航中有导航栏和搜索栏。点击搜索栏后,它会移动到没有任何导航的搜索页面,如果我退出搜索页面,主页导航消失,有人能帮助我如何放置导航栏吗从swift 3中的任何视图控制器返回时的主页

下面是我的图片

使用的代码如下所示

func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let abcViewController = storyboard.instantiateViewController(withIdentifier: "filterPage") as! filterPageViewController
    self.navigationController?.pushViewController(abcViewController, animated: true)
 }
从搜索页面返回的代码是

func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
   self.navigationController?.popViewController(animated: true)
}
如果需要隐藏或使导航栏在ViewController(VC)上可见,只需在“视图将出现”和“视图将消失”函数中执行即可

在您的家庭VC上,添加以下行

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)

    self.navigationController?.setNavigationBarHidden(false, animated: true)
}
或者在搜索页面视图中启用导航栏

 override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

// Show the Navigation Bar
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

您是否在搜索页面中的导航栏中的任何位置隐藏?是的,在搜索页面中我不需要任何导航栏,所以我正在隐藏导航栏@Anbu.karthik