На iOS 26 Beta 3 у меня есть Uitabbar в виде с Systembackground в качестве цвета фона. В темном режиме текст для не выбранных элементов выглядит черным, и его невозможно прочитать. Он отлично работает в Swiftui, и ни одно из системных приложений не имеет такого же поведения. class = "Lang-Swift PrettyPrint-Override">func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = .init(windowScene: windowScene)
let tabVC = Self.makeTabVC()
window?.rootViewController = tabVC
window?.makeKeyAndVisible()
}
static func makeTabVC() -> UIViewController {
let tabVC = UITabBarController(tabs: [
.init(title: "View 1", image: .init(systemName: "1.circle"), identifier: "Tab.vc1", viewControllerProvider: { _ in
return ViewController(text: "View 1", color: .systemBackground)
}),
.init(title: "View 2", image: .init(systemName: "2.circle"), identifier: "Tab.vc2", viewControllerProvider: { _ in
return ViewController(text: "View 2", color: .blue)
})
])
return tabVC
}
< /code>
my viewcontroller код: < /p>
class ViewController: UIViewController {
convenience init(text: String, color: UIColor) {
self.init(nibName: nil, bundle: nil)
self.text = text
self.color = color
}
var text: String!
var color: UIColor!
private var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
label = UILabel()
view.addSubview(label)
label.center = view.center
label.translatesAutoresizingMaskIntoConstraints = false
label.text = text
label.sizeToFit()
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
view.backgroundColor = color
// Do any additional setup after loading the view.
}
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... -in-ios-26
Неправильное появление Uitabbar в iOS 26 ⇐ IOS
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение