Right here for instance, that is from the native messaging app on iOS the footer backside bar is black because the background. It would not have any totally different coloration, lighter than that:
Right here it’s properly clear and blurry when the message scrolls move behind it:
I need to obtain this impact in my code, nonetheless I am unable to obtain this in any respect.
Right here is an instance of my app, when content material is empty:
And right here is with content material behind it:
I see another apps are utilizing similar approach, just like the fb messenger or sign apps.
Right here is my code:
let toolbarBackground = UIToolbarAppearance()
toolbarBackground.backgroundEffect = UIBlurEffect(model: .systemUltraThinMaterial)
toolbarBackground.backgroundColor = UIColor(dynamicProvider: { traitCollection in
return traitCollection.userInterfaceStyle == .darkish ?
UIColor.black.withAlphaComponent(0.5) : UIColor.white.withAlphaComponent(0.8)
})
toolbarBackground.shadowColor = .clear
UIToolbar.look().standardAppearance = toolbarBackground
UIToolbar.look().scrollEdgeAppearance = toolbarBackground
The half UIColor.white.withAlphaComponent(0.8)
is for mild mode, and has no impact on darkish mode.