我具有以下设置:
我想像下面这样以编程方式启动MenuViewController +底部的标签栏:
let storyboard = UIStoryboard(name: "Employee", bundle: nil)
let tabbarVC = storyboard.instantiateViewController(withIdentifier: "tabBar") as! UITabBarController
self.present(tabbarVC, animated: false, completion: nil)
不幸的是,没有启动视图,只是什么也没有发生。有什么想法吗?
@ Bozzo Game发表评论后,我已经找到解决此问题的方法。
行self.present(tabbarVC, animated: false, completion: nil)
必须替换为
UIApplication.shared.keyWindow?.rootViewController = tabbarVC
因为这里的想法不是使用present
在当前的顶部显示tabbarVC,而是更改Window的rootViewController。