美文网首页
ios swift tableView 刷新某一行某一组,及UI

ios swift tableView 刷新某一行某一组,及UI

作者: aggie1024 | 来源:发表于2019-12-26 18:45 被阅读0次

// OC 刷新tableView的行和组

// 刷新某些行,传入一个indexPath的数组(可以刷新多行)

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

[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];



// 刷新某一组

NSIndexSet *indexSet = [[NSIndexSet alloc]initWithIndex:1]; // 组数

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

// 刷新从第0组开始的两组,也就是刷新 第0组 和 第1组

NSIndexSet *indexSet = [[NSIndexSet alloc]initWithIndexesInRange:NSMakeRange(0, 2)];

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

// Swift 刷新tableView的行和组

    // 刷新某些行 (传入参数是 元素为IndexPath类型的数组“[IndexPath]”),所以可以刷新某几行

    let indexPath: IndexPath = IndexPath.init(row: 1, section: 0)

    self.tableView.reloadRows(at: [indexPath], with: .fade)

    // 刷新第几组,直接传入要刷新的组数集合 “[section]”

    self.tableView.reloadSections([1], with: .fade)

/************* UITableViewRowAnimation 的风格效果 ****************/

/*

     public enum UITableViewRowAnimation : Int {

     

     case fade  // 淡入淡出

     

     case right // slide in from right (or out to right) 从右滑入(或从右出去)

     

     case left  // 从左滑入

     

     case top   // 从上滑入

     

     case bottom    // 从下滑入

     

     case none // available in iOS 3.0

     

     case middle // available in iOS 3.2.  attempts to keep cell centered in the space it will/did occupy

     

     case automatic // available in iOS 5.0.  chooses an appropriate animation style for you

     }

    */

原文链接:https://blog.csdn.net/IAmOnMyOwnWay/article/details/73480346

相关文章

网友评论

      本文标题:ios swift tableView 刷新某一行某一组,及UI

      本文链接:https://www.haomeiwen.com/subject/wnyloctx.html