I have a Uitableview with loading mode like that, When user scroll to item 5 it'll auto load 10 item and add in the top of label. My problem is when add like that, current cell move down 10 item, it's bad look.
Can we add 开发者_运维知识库cell at top UITableView but current cell not move up or down until user scroll.
What you could do is insert your rows, then use scrollToRowAtIndexPath:atScrollPosition:animated:
method to scroll to the row you would like to display. More info here.
Just posted an answer with code snippets here
Keep uitableview static when inserting rows at the top
Basically:
- Save the scroll offset where you would have called beginUpdate:.
- In place of calls to InsertCell you add the cell's height to the saved offset.
- Where you would have called endUpdate:, call reloadData, then scroll by the saved offset with NO animation.
精彩评论