recently, I updated my Xcode 13 and my navigationBar broke like this:
it's same code and same Xcode but in iOS 15 simulator, scrollEdgeAppeance's shadow override standard one. it should be like this(same code in iOS 14 simulator).
here's my code (I turned shadow image to solid image to see clearly):
class MyViewController: UINavigationViewController {
override func viewDidLoad() {
super.viewDidLoad()
let standard = UINavigationBarAppearance()
standard.configureWithOpaqueBackground()
standard.backgroundColor = .systemBlue
standard.shadowImage = UIImage(color: .black)
standard.shadowColor = .clear
navigationBar.standardAppearance = standard
let scroll = UINavigationBarAppearance()
scroll.configureWithOpaqueBackground()
scroll.backgroundColor = .systemRed
scroll.shadowImage = UIImage()
scroll.shadowColor = .clear
navigationBar.scrollEdgeAppearance = scroll
}
}
it changes background color when scroll(large title ↔ standard title) but shadow image is not working.
how can I do?
what I want to do:
- I use solid image in example however I want to use alpha gradated shadow image. (not a template line shadow. it's important.)
- in large title appearance(scrollEdgeAppearance I think), shadow should not be appear.
- in standard title appearance(standardAppearance I think), shadow should be appear.