刷新单个cell 和 刷新单个 section

2018-08-20  本文已影响0人  在下有双
/**
 *  单个cell的刷新
 */
//1.当前所要刷新的cell,传入要刷新的 行数 和 组数
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
//2.将indexPath添加到数组
NSArray <NSIndexPath *> *indexPathArray = @[indexPath];
//3.传入数组,对当前cell进行刷新
[tableView reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationAutomatic];

/**
 *  单个Section的刷新
 */
//1.传入要刷新的组数
NSIndexSet *indexSet=[[NSIndexSet alloc] initWithIndex:0];
//2.传入NSIndexSet进行刷新
[tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
上一篇 下一篇

猜你喜欢

热点阅读