pronebird / UIScrollView-InfiniteScroll

UIScrollView ∞ scroll category
MIT License
1.06k stars 148 forks source link

Content size problems. #43

Closed NikKovIos closed 8 years ago

NikKovIos commented 8 years ago

When calling finishInfiniteScroll, tableView's content size changing, so when i drag up - table view lagging, becouse, i think, it recalculating size. For note: i use UITableViewAutomaticDimension for calculating row height.

pronebird commented 8 years ago

Yes there is an issue with that, we force content size recalculation to make sure that scroll offset remains the same if more content is added, otherwise it tends to bounce back, layout calculations usually happen too late when they happen on their own.

That does not seem to be the case for cells with fixed height.

Maybe instead of forcing content size we could fix content offset, need to play with it.

Relevant hack we use to force update content size:

https://github.com/pronebird/UIScrollView-InfiniteScroll/blob/master/Classes/UIScrollView%2BInfiniteScroll.m#L40

NikKovIos commented 8 years ago

I figured out, that this problem is because of UITableViewAutomaticDimension. When i implemented fixed height for cell everything is all right. Also i figured out, that when table fully scrolled down - contentSize is, for example, 1000. All cell fitted content and result tableV content size is 1000.

Want to tell you, that your code style is good (IMHO), i like it =)

NikKovIos commented 8 years ago

Ok, i fixed it by this answer

pronebird commented 8 years ago

@NikKovV

Thanks :-)

Yes, self-sizing cells have been giving me a lot of pain, not only with infinite scroll. Unfortunately we don't have full control over table views and timing is not always right, so sometimes things may not look as smooth.

What was the thing with reloadData? Do you add new rows into table view or simply reload everything?

NikKovIos commented 8 years ago

In realm [tableView reloadData] called, every time any realm object updates. So when it added new rows, it has been called.

pronebird commented 8 years ago

@NikKovV normally to run animations properly you should batch updates, reloadData looks more like a hard reset to me, but I don't know if Realm has anything similar to FRC that would allow to receive incremental updates from store.

pronebird commented 8 years ago

Feel free to reopen, but I guess at this point we can't do anything with table view.