我创建了一个包含TabBarController的StoryBoard,其按钮每个都链接到嵌入在导航控制器中的ViewControllers。在应用程序中有一点我需要显示一个View,它不是这个TabBarController的一部分,然后返回到TabBarController。我正在使用抽屉在两个视图之间切换(TabBar和单独的ViewController)。我在抽屉的tableView的didSelectRowAtIndexPath
中使用此代码
case 0:
var appDelegate: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.centerContainer!.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil)
break;
case 1:
var appDelegate: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var centerViewController = mainStoryboard.instantiateViewControllerWithIdentifier("TabBarController") as! TabBarController
var centerNav = UINavigationController(rootViewController: centerViewController)
appDelegate.centerContainer?.setCenterViewController(centerNav, withFullCloseAnimation: true, completion: nil)
appDelegate.centerContainer!.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil)
break
案例2使TabBarController中导航控制器上的导航栏按钮项消失。为什么呢?