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.