I got a strange problem with my UITableView: I use reloadRowsAtIndexPaths:withRowAnimation:
to reload some specific rows, but the app crashes with an seemingly unre
The problem is that you, probably, have changed size of your table. For example, you have add or remove some source data for table view.
In that case, when you call reloadData
your table is completely reloaded including sizes of sections and number of that sections.
But when you call reloadRowsAtIndexPaths:withRowAnimation:
that parameters of your table view are not reloaded. That causes next problem: when you are trying to reload some cell table check the size of table view and sees that it has been changed. That results in a crash. This method can be used only when you wan't to reload view of the cell (for example, label has changed or you want to change its size).
Now if you want to remove/add cells from/to table view you should use next approach:
beginUpdates
of UITableView
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
endUpdates
of UITableView
Hope it will be helpful