在Xcode 10中,unselectedItemTintColor属性正常工作,但在Xcode 11和iOS 13中,UITabbar的unselectedItemTintColor属性不起作用。
override func viewDidLoad() {
super.viewDidLoad()
myTabbar.unselectedItemTintColor = .red
}
if #available(iOS 13.0, *) { let statusBar = UIView(frame: UIApplication.shared.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero) statusBar.backgroundColor = UIColor.red // Set any desired color UIApplication.shared.keyWindow?.addSubview(statusBar) }
这将在iOS 13及更高版本中创建一个自定义状态栏,并将其添加到应用程序窗口中。请注意,此代码仅适用于使用Swift编写的应用程序。 - Keshu R.