Ios 使用SWREVEL视图控制器隐藏选项卡栏项
我正在使用Ios 使用SWREVEL视图控制器隐藏选项卡栏项,ios,swift,swrevealviewcontroller,Ios,Swift,Swrevealviewcontroller,我正在使用SWRevealViewController和TabBar控制器作为前端,我在其中放置了TableView作为swrevealvc的后视图。 我的UI看起来像这样 现在,当我点击table view并想打开第一个选项卡栏时,它会从底部隐藏我的选项卡栏。通过此代码,我尝试打开我的选项卡栏控制器 var menuVCBeforeLoginArray = ["NewsVC","BookmarkVC","MessageVC"] let vcIdentifier = menuVCBeforeL
SWRevealViewController
和TabBar控制器
作为前端,我在其中放置了TableView
作为swrevealvc
的后视图。
我的UI看起来像这样
现在,当我点击table view并想打开第一个选项卡栏时,它会从底部隐藏我的选项卡栏。通过此代码,我尝试打开我的选项卡栏控制器
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)
现在,当它打开第一个选项卡栏时,它看起来是这样的,隐藏了底部栏
即使从侧边菜单打开VC,如何显示底部栏?您不应该使用带有
导航控制器的选定viewcontroller来推动。获取选项卡栏控制器
并更改所选索引
//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
}
您不应使用带有
导航控制器的选定viewcontroller进行推送。获取选项卡栏控制器
并更改所选索引
//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
}