📚苹果

iOS tableview的某一行或某一组数据刷新取消动画效果

2017-10-20  本文已影响1218人  紫荆逸

主要是需要这个:
UIView.performWithoutAnimation {//取消刷新动画 }

swift方法:

  UIView.performWithoutAnimation {//取消刷新动画
                self?.tableView.reloadSections([0], with: .none)
   }

OC方法:

[UIView performWithoutAnimation:^{
            NSInteger index = [self indexOfCellType:TNDCPlayHomeContentSectionTypeTagList];
            [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:index] withRowAnimation:UITableViewRowAnimationNone];
        }];

【拓展】

1.刷新某一行cell
//一个cell刷新    
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0];    
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];  
2.刷新某一组数据
//一个section刷新    
NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];    
[tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];    
上一篇 下一篇

猜你喜欢

热点阅读