I'm using SWRevealViewController
with TabBar Controller
as front and a VC in which I have placed TableView
as a rear view for SWReveal VC
.
My UI Looks like this,
Now when I click on table view and want to open first tab bar VC it hides my Tab bar from the bottom. Through this code I try to open my TabBar Controller
,
var menuVCBeforeLoginArray = ["NewsVC","BookmarkVC","MessageVC"]
let vcIdentifier = menuVCBeforeLoginArray[indexPath.row]
let vc = storyboard!.instantiateViewController(withIdentifier: vcIdentifier)
let navVC = UINavigationController.init(rootViewController: vc)
self.revealViewController().pushFrontViewController(navVC, animated: true)
Now when it opens the first tab bar it looks like this with hidden bottom bar.
How can I show the bottom bar even when I open VC from side menu?
You should not push with selected viewcontroller with a navigation controller
. Get the tabbar controller
and change selectedIndex
//var menuVCBeforeLoginArray = ["NewsVC","BookmarkVC","MessageVC"]
//let vcIdentifier = menuVCBeforeLoginArray[indexPath.row]
//let vc = storyboard!.instantiateViewController(withIdentifier: vcIdentifier)
//let navVC = UINavigationController.init(rootViewController: vc)
//self.revealViewController().pushFrontViewController(navVC, animated: true)
if let tabBarController = self.revealViewController().frontViewController as? UITabBarController {
tabBarController.selectedIndex = indexPath.row
}