0

I'm trying to implement the new largeTitleDisplayMode feature in my app. I have a top level mainScrollview that that has multiple childTableViews inside of it. You can swipe left/right(basic page control) inside the mainScrollview to view all the childTableViews. Since all my childTableViews are inside the mainScrollview, the navigation bar's largeTitleDisplayMode functionality does not respond to any of the childTableViews scrolling. Is there a way to to tell the navigationController to respond to a specific scrollView subclass(childTableViews in this case)?

Salil Thakur
  • 118
  • 1
  • 8

1 Answers1

0

You can try UIScrollViewDelegate scrollViewDidEndDecelerating and calculate which index is on view, so you can update your title. If I understood what you want to do.

Gehlen
  • 160
  • 1
  • 15
  • I already tried doing that with something like `UIView.animate(withDuration: 0.2) {self.navigationItem.largeTitleDisplayMode = .always}` in my `scrollViewDidEndDecelerating` delegate method. But this is not as smooth. I want the nav bar to collapse/expand interactively as the childTableViews scrolls. – Salil Thakur Jul 30 '18 at 19:22
  • What about a 'custom view title'? Can you provide some example of your animation? – Gehlen Jul 30 '18 at 19:24
  • As of now there is no animation since the childTableViews are not triggering the largeTitleDisplayMode. But I want the expected behavior to be like how it is [here](https://cdn-images-1.medium.com/max/1200/1*Owr4YZtbYYkOhXd78R7bqQ.gif). But instead of just one tableView of countries, I have multiple tableView inside of a scrollView at the top level. – Salil Thakur Jul 30 '18 at 19:36
  • So you gonna need to implement a custom navigation like in this example: https://stackoverflow.com/questions/42953360/swift-how-to-do-add-an-header-with-parallax-effect-to-tableview or here, another great tuto: https://medium.com/if-let-swift-programming/how-to-create-a-stretchable-tableviewheader-in-ios-ee9ed049aba3 So in this example you just need to add a label a handle its size with the scroll – Gehlen Jul 30 '18 at 20:27