NSIndexPath(转)

编辑器加载中...是Foundation框架中的一个普通的类,它提供了到嵌套数列的树中特定节点的路径,事实上,它是一个整数阵列,表格视图使用这个去表现在特定章节中的特定行,UITableView用的所有索引路径正好有两个元素,第一个是章节,第二个是行。 NSIndexPath和TableViews @interfaceNSIndexPath (UITableView) { } +(NSIndexPath*)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section; @property(nonatomic,readonly)NSUIntegerrow; @property(nonatomic,readonly)NSUIntegersection; @end NSIndexPath是一種特別的資料類別,這是用來表示一個路徑,這個路徑是指到一個從0開始的巢狀集合陣列樹狀結構的某個節點。iPhone OS為UITableView擴充了這個類別(見NSIndexPath UIKit Additions這是用分類擴充),加入了一個用來建立新的NSIndexPath實體的「(NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section」方法和row和section兩個屬性。 原帖:http://blog.163.com/hw707@126/blog/static/68486388201011255624582/ 原博文:http://blog.csdn.net/bellajo/article/details/6772556 nsindexpath的compare方法: compare: Indicates the depth-first traversal order of the receiving index path and another index path. - (NSComparisonResult)compare:(NSIndexPath *)indexPath Parameters indexPath Index path to compare. This value must not be nil. If the value is nil, the behavior is undefined. Return Value The depth-first traversal ordering of the receiving index path and indexPath. NSOrderedAscending: The receiving index path comes before indexPath. NSOrderedDescending: The receiving index path comes after indexPath. NSOrderedSame: The receiving index path and indexPath are the same index path. Availability Available in Mac OS X v10.4 and later. Declared In NSIndexPath.h
posted @   郑文亮  阅读(1204)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示