将UINavigationController添加到UISplitViewController中的UITabBarController时,在运行iOS 11的iPad上,状态栏现在会显示导航栏。
示例代码:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow.init(frame: UIScreen.main.bounds)
let t1 = Test2ViewController.init(nibName: "Test2ViewController", bundle: nil)
t1.view.backgroundColor = UIColor.green
let t1nvc = UINavigationController.init(rootViewController: t1)
let tbc = UITabBarController.init()
tbc.viewControllers = [t1nvc]
let t2 = Test2ViewController.init(nibName: "Test2ViewController", bundle: nil)
t2.view.backgroundColor = UIColor.red
let splitView = UISplitViewController()
splitView.viewControllers = [tbc, t2]
self.window!.rootViewController = splitView;
self.window!.makeKeyAndVisible()
return true
}
手机视图[iOS 11]:
*这看起来不错
iPad查看[iOS 11]:
*注意状态栏
iPad View [iOS 10.3]:
*状态栏看起来正确