UITableView重新整理分為整體重新整理和局部重新整理,必須先修改資料,然後再重新整理。
1)整體重新整理:
// 先修改模型資料
NSString *text = [alertView textFieldAtIndex:0].text;
shop *shop = _shops[row];
shop.desc = text;
// 再重新整理整個表格(所有資料都變動)
[_tableView reloadData];
2)局部重新整理(個别資料有變動)
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
NSArray *paths = @[indexPath];
[_tableView reloadRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];
轉載于:https://www.cnblogs.com/yuyu-2012/p/4645182.html