hidesBottomBarWhenPushed not working in swift

Viewed 85

In my project I am using hidesBottomBarWhenPushed as

Tried 1:

  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let vc =  AppStoryboard.Chat.instance.instantiateViewController(withIdentifier: "ChatDetailViewController") as! ChatDetailViewController
        vc.hidesBottomBarWhenPushed = true
        navigationController?.pushViewController(vc, animated: true)
    }

But still tabBar is visible.

Tried 2

I also tried tabBar.isHidden but doesn't works .

Tried 3

In My TabBarController Class I used hidesBottomBarWhenPushed = true

2 Answers

try this

 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let vc =  AppStoryboard.Chat.instance.instantiateViewController(withIdentifier: "ChatDetailViewController") as! ChatDetailViewController
        self.hidesBottomBarWhenPushed = true
        navigationController?.pushViewController(vc, animated: true)
    }

Try this this will work fine

navigationController.hidesBottomBarWhenPushed = true
Related