tatableView 刷新

1.一般情况下,刷新tableView,我们会直接调用reloadData方法   

    [self.tableView reloadData];

 但是有的时候我们需要刷新指定的cell和section,这个时候在调用reloadData的话,就浪费资源了。

2.刷新局部的cell

 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

 [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];

3.刷新局部的section

NSIndexSet *indexSet = [[NSIndexSet alloc] initWithIndex:0];

 [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade];

4.刷新动画

typedef NS_ENUM(NSInteger, UITableViewRowAnimation) {

    UITableViewRowAnimationFade,

    UITableViewRowAnimationRight,           

    UITableViewRowAnimationLeft,

    UITableViewRowAnimationTop,

    UITableViewRowAnimationBottom,

    UITableViewRowAnimationNone,            

    UITableViewRowAnimationMiddle,          

    UITableViewRowAnimationAutomatic = 100  

};

1
原文地址:https://www.cnblogs.com/fantasy3588/p/4744533.html