carekit-apple/CareKit

Navigation bar is clear for iOS 15.0+

Hengyu opened this issue · 3 comments

Hi team,

The navigation bar in OCKDailyPageViewController is clear. And one can verify this visual bug when scrolling the content.
Please see the attachment below to find the details.

1

This issue happens in iOS 15.0+ devices, and it does not appear in iOS 14.0+ devices.

Can someone take a look? Thanks in advance!

Hi, can confirm I am seeing this as well. #650

Here's the fix

if #available(iOS 15.0, *) {
let navigationBarAppearance = UINavigationBarAppearance()
navigationBarAppearance.configureWithDefaultBackground()
UINavigationBar.appearance().standardAppearance = navigationBarAppearance
UINavigationBar.appearance().compactAppearance = navigationBarAppearance
UINavigationBar.appearance().scrollEdgeAppearance = navigationBarAppearance
}

Hi Magray,

Just tried your fix, it works! Thanks so much!
By the way, we don't need to set standardAppearance and compactAppearance. And the simplified version would be:

if #available(iOS 15.0, *) {
    let navigationBarAppearance = UINavigationBarAppearance()
    navigationBarAppearance.configureWithDefaultBackground()
    UINavigationBar.appearance().scrollEdgeAppearance = navigationBarAppearance
}