更新时间:2023-02-02 13:11:44
在包含 UISwitch
的 UITableViewCell
中,我遇到了同样的问题.我通过在重新加载各节之前调用 [self.tableview reloadData]
解决了该问题:
I had the same issue in UITableViewCell
comprising UISwitch
. I solved the problem by calling [self.tableview reloadData]
before reloading the sections:
NSIndexSet *sections = [[NSIndexSet alloc] initWithIndex:2];
[self.tableView reloadData];
[self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationFade];
如果您致电,也会发生相同的问题
The same problem happens if you call:
[self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathsForVisibleRows] withRowAnimation:UITableViewRowAnimationFade]
无需先重新加载数据.