【问题标题】:Obj-c - Number table cells descending instead of ascending?Obj-c - 数字表格单元格降序而不是升序?
【发布时间】:2019-01-31 06:08:50
【问题描述】:

我的单元格中目前有一个 UILabel,它显示从顶部 1 开始的计数 (1, 2, 3, 4...)。但是,我怎样才能使计数下降呢?看起来很简单,但我似乎无法弄清楚。

我当前的代码:

 cell.countLabel.text = [NSString stringWithFormat:@"%ld)", (long)indexPath.row +1];

【问题讨论】:

    标签: ios objective-c uitableview


    【解决方案1】:

    你可以从 indexpath.row 中减去项目的总数

    cell.countLabel.text = [NSString stringWithFormat:@"%ld)", (long)(items.count - indexPath.row)];
    

    【讨论】:

      猜你喜欢
      • 2018-10-08
      • 2011-12-02
      • 1970-01-01
      • 2022-09-27
      • 1970-01-01
      • 2015-09-19
      • 1970-01-01
      • 2018-01-14
      • 1970-01-01
      相关资源
      最近更新 更多