Warum ist der Farbmodus der Navigationsleiste falsch, wenn in iOS 26 'Transparenz reduzieren' aktiviert ist?IOS

Programmierung für iOS
Anonymous
 Warum ist der Farbmodus der Navigationsleiste falsch, wenn in iOS 26 'Transparenz reduzieren' aktiviert ist?

Post by Anonymous »

Die App verwendet also adaptive Farbsätze in Assets.xcassets, um helle und dunkle Modi zu verarbeiten. Normalerweise funktioniert alles einwandfrei - die Farben zeigen in der App korrekt, einschließlich der Navigationsleiste. Es wird zu einem leichten Erscheinungsbild gezwungen, das die visuelle Konsistenz bricht, da sich der Rest der App noch im dunklen Modus befindet.static func getAppearance() -> UINavigationBarAppearance {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .background
appearance.backgroundEffect = nil
appearance.titleTextAttributes = [.foregroundColor: UIColor.navbarTitle]
return appearance
}
func updateAppearance() {

let appearance = Self.getAppearance()
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
UINavigationBar.appearance().compactAppearance = appearance

self.navigationBar.standardAppearance = appearance
self.navigationBar.scrollEdgeAppearance = appearance
self.navigationBar.compactAppearance = appearance

self.setNeedsStatusBarAppearanceUpdate()
}
< /code>
Die Background -Farbe ist tatsächlich UIColor (mit dem Namen "Hintergrund"), wobei der Hintergrund in .xcasset -Datei definiert ist. />
while wenn "Transparenz" -Option "Transparenz reduzieren" ist auf:

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post