简体   繁体   English

重新加载UITableViewCell而不使用UITableView滚动

[英]Reload UITableViewCell without UITableView scrolling

I'm using a UISegmentedControl which changes the contents of a UITableViewCell . 我正在使用UISegmentedControl来更改UITableViewCell的内容。 After the segment changes I need to reload the cell to update the height of it. 在段更改后,我需要重新加载单元格以更新它的高度。 I do this by calling: 我这样做是通过调用:

[self.tableView reloadRowsAtIndexPaths:@[self.segmentIndexPath] withRowAnimation:UITableViewRowAnimationNone];

However, this makes the UITableView scroll to the top. 但是,这会使UITableView滚动到顶部。 What is the best way to do this without having the table scroll? 没有表滚动的最佳方法是什么?

尝试使用[self.tableView visibleCells] ,然后找到此单元格并进行更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM