NSIndexPath类

  NSIndexPath类表示到嵌套的数组集合的树中的特定节点的路径。这条道路被称为索引路径

  如下图:

              position       0        1         2         3

           Index path 1.4.3.2

     方法:

  1.创建索引路径

  Creates an one-node index path.

  + (instancetype _Nonnull)indexPathWithIndex:(NSUInteger)index

  - (instancetype _Nonnull)initWithIndex:(NSUInteger)index

 

  Creates an index path with one or more nodes.

  + (instancetype _Nonnull)indexPathWithIndexes:(const NSUInteger [])indexes
                                                  length:(NSUInteger)length

  - (instancetype _Nonnull)initWithIndexes:(const NSUInteger [])indexes
                                                        length:(NSUInteger)length

 

  2.查询索引路径(Querying Index Paths)

  - (NSUInteger)indexAtPosition:(NSUInteger)node

  Retrun Value:

  The index value at node or NSNotFound if the node is outside the range of the index path.

 

posted @ 2016-01-15 17:36  LaiSong  阅读(406)  评论(0编辑  收藏  举报