UITableView Scrolls to Top on Cell Refresh

后端 未结 4 1852
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 10:08

I have a UITableView with a cell that is dynamically sized to fit a UITextView inside it. Whenever a key is typed, the cell checks to see if the calculated height has increased,

4条回答
  •  情深已故
    2021-02-04 10:23

    Just a guess...

    Save the contentOffset of the uitableview before any changes. Then set it again after.

    CGFloat contentOffset = self.tableView.contentOffset;
    

    and then after the changes

    self.tableView.contentOffset = contentOffset;
    

提交回复
热议问题