Swift 5 Shrinking / Growing Navigation Large Titles Programmatically

Viewed 232

So I have a controller with a large titled navigation controller and UIScrollView. I'm trying to make the large title shrink / grow with it's natural movement (like when scrolled with finger on UI). I thought it listens and responds to the first vertical scroll view it finds but setContentOffset does not shrink the large title.

Here is what happens when I did scrollView.setContentOffset(CGPoint(x: 0, y: 30), animated: true) :

does not shrink

And here is what happens when I scroll with finger on screen :

shrinks with UI scroll

Note that I don't want to simulate the grow / shrink movement using UIView.animate with

navigationItem.largeTitleDisplayMode = .never

or

navigationController?.navigationBar.prefersLargeTitles = false

Here goes the question : Is it possible to programmatically to shrink / grow the navigation bar large title with its natural movement or are there any workarounds (like setting content offset of the scroll view but that didn't work) ?

0 Answers
Related