tableView delete/insert时必须begin&
2020-03-02 本文已影响0人
wustzhy
tableView delete/insert cell时注意,必须 调begin&endUpdates,否则就crash
官方参考 Table View Programming Guide for iOS

- (void)beginUpdates;
- (void)endUpdates;
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
...