【问题标题】:Shift NSIndexPath entities移动 NSIndexPath 实体
【发布时间】:2012-08-28 16:53:03
【问题描述】:

我一直在阅读 NSIndexPaths 以获取 uitableviews 等。但我很难操作现有的索引路径。

我想在保留行的同时采用现有的索引路径增量/移动每个部分。因此 indexPath.section 0 变为 indexPath.section 1 等。非破坏性地移动关联的行数。

我知道 NSIndexPath 是不可变的,但它们有任何类别或好的模式支持这一点吗?

【问题讨论】:

    标签: objective-c ios cocoa-touch nsindexpath


    【解决方案1】:

    好吧,您总是可以从旧实例中创建一个稍加改动的新实例。

    NSIndexPath *newPath = [NSIndexPath indexPathForRow:oldPath.row 
                                              inSection:oldPath.section+1];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-02
      • 1970-01-01
      • 2014-09-25
      相关资源
      最近更新 更多