,可以通过以下步骤实现:
下面是一个示例代码:
// 创建要显示的视图控制器
let viewController1 = UIViewController()
viewController1.view.backgroundColor = UIColor.red
viewController1.title = "ViewController 1"
let viewController2 = UIViewController()
viewController2.view.backgroundColor = UIColor.blue
viewController2.title = "ViewController 2"
// 创建UITabBarController实例
let tabBarController = UITabBarController()
tabBarController.viewControllers = [viewController1, viewController2]
// 隐藏选项卡栏
tabBarController.hidesBottomBarWhenPushed = true
// 呈现UITabBarController
present(tabBarController, animated: true, completion: nil)
这样,通过present方法呈现UITabBarController的实例时,将显示视图控制器,但不显示选项卡栏。
推荐的腾讯云相关产品和产品介绍链接地址:
领取专属 10元无门槛券
手把手带您无忧上云