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 view started with wrong content offset on some occasions #117

Closed gfzabarino closed 8 years ago

gfzabarino commented 8 years ago

Hey there, I was having an issue on a project I'm working on using this library. The issue was that a table view was being displayed with the wrong contentOffset when first loaded. The contentInset was fine though. In my particular case, the contentInset was 108 (20 status bar + 44 nav bar + 44 custom extension view). But after the contentInset was set by this library, the contentOffset was still using a previous value. I don't exactly know why this happened now (this didn't happened before), but the changes I'm sending fixes the issue.

Basically, if by the time the contentInset was being set in the beginning the preserveOffset flag would have been YES, then the contentOffset property would have been updated correctly. However, forcing this to YES caused that when scrolling, the contentOffset was being modified as well, causing the amount of points to be scrolled to double.

What I did to correct this was to remove this flag and rely on some flags about the scroll view itself.

Does this look good to you? Any thoughts about this PR? Thanks for this awesome library!

Mazyod commented 8 years ago

This looks awesome :ok_hand: I want to make sure it actually solves all the edge cases I have encountered in the past, so I'll pull the code and test it right now.

Mazyod commented 8 years ago

Superb contribution! After testing, I don't see any issues at all with this. Getting rid of code and fixing bugs has got to be the best thing any programmer can contribute :D Cheers!

gfzabarino commented 8 years ago

Glad it worked!