objective-c - 如何创建 NSIndexPath :indexPathWithIndexes:length: 所需的 "indexes"

标签 objective-c cocoa

创建一个或多个节点的索引路径的类方法是:

+ (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length

我们如何创建第一个参数中所需的“索引”?

文档将其列为组成索引路径的索引数组,但它需要一个 (NSUinteger *)。

创建1.2.3.4的索引路径,是不是简单的[1,2,3,4]数组?

最佳答案

你是对的。你可以这样使用它:

NSUInteger indexArr[] = {1,2,3,4};

NSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:indexArr length:4];

关于objective-c - 如何创建 NSIndexPath :indexPathWithIndexes:length: 所需的 "indexes",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/181432/

相关文章:

cocoa - 正确处理异步 NSObject

ios - 无法从枚举 block 将 ALAssets 添加到 NSOperationQueue

ios - 检测应用程序是否从推送通知启动/打开,然后将其重定向到特定的 View Controller

ios - UIPopoverController 在 iOS 8 中显示为 modalViewController

macos - NSSplitView 起始大小的问题( Storyboard和 Swift)

objective-c - 有时我想阻止我的 Cocoa 应用程序启动,如何在 init 中阻止它?

ios - UITableView 核心数据分组和关系

iphone - 有没有办法查明 iPhone 是否通过 A-GPS、手机信号塔信号强度或 wifi 获得了 CLLocation?

iphone - 从具有 BOOL 值的 plist 问题中读取 NSDictionary

objective-c - 如何在 Interface Builder (Xcode 5) 中编辑工具栏?