telly / TLYShyNavBar

Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars!
MIT License
3.73k stars 427 forks source link

Scroll position detection doesn't play nice with table view estimated row heights #126

Open janardanyri opened 8 years ago

janardanyri commented 8 years ago

I'm using estimatedRowHeight and AutoLayout cell height pinning in a UITableView.

I ran into a bug with this sequence of events:

At this point, UITableView seems to have forgotten all its offscreen cell heights, and makes up a new contentOffset using estimatedRowHeight. Now you...

At this point, every time a new cell comes onto the screen with a new known height, UITableView silently incrementally fixes its contentOffset and the positions of all its subviews!

The shy nav bar of course doesn't know any of this is happening. Instead, if a cell scrolls onscreen that is taller than the estimated height, the shy nav bar just sees the scroll position suddenly lurch downward. It, accordingly, suddenly snaps the nav bar upward.

I "fixed" this by changing my estimatedRowHeight to be slightly larger than the maximum possible size for my cells, which happens to give acceptable results for my use case. I'm not sure how you get a general fix except by sniffing for this specific funky behavior from UITableView.

ghost commented 7 years ago

stumbled upon this after fighting this issue for days. Don't it has anything to do with this library, but more so just the behavior or UITableViews themselves. Thank You!!