I am trying to show a large Title
in a Navigation bar
, but with clear background. When scrolled up, it will be the Navigation bar
with a blur effect.
This looks correct, however, when scrolling, the animation seems to be broken. Also, transition gets stuck from time to time:
My code as follows:
UINavigationController
:
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 13.0, *) {
self.navigationBar.prefersLargeTitles = true
let style = UINavigationBarAppearance()
style.configureWithDefaultBackground()
style.titleTextAttributes = [.font: UIFont.systemFont(ofSize: 18)]
self.navigationBar.standardAppearance = style
self.navigationBar.compactAppearance = style
//Configure Large Style
let largeStyle = UINavigationBarAppearance()
largeStyle.configureWithTransparentBackground()
largeStyle.largeTitleTextAttributes = [.font: UIFont.systemFont(ofSize: 28)]
self.navigationBar.scrollEdgeAppearance = largeStyle
}
}
The UITableView
is inside the UINavigationController
. Both are from storyboards via a segue way.