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.
?
轉載于:https://www.cnblogs.com/LaiSong/p/4672820.html
總結
以上是生活随笔為你收集整理的NSIndexPath类的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Bootstrap 手风琴搭配导航条实现
- 下一篇: java --推送