简体   繁体   English

我们可以在NSIndexPath对象中存储什么类型的数据

[英]what type of data we can store in NSIndexPath object

因为我们可以在NSString对象中存储字符的集合,而在NSDictionary对象中存储键值对,所以我们可以在NSIndexpath对象中存储哪些数据类型

The NSIndexPath class represents the path to a specific node in a tree of nested array collections. NSIndexPath类表示嵌套数组集合树中特定节点的路径。 This path is known as an index path. 该路径称为索引路径。

Each index in an index path represents the index into an array of children from one node in the tree to another, deeper, node. 索引路径中的每个索引代表从树中一个节点到另一个更深节点的子节点数组的索引。 For example, the index path 1.4.3.2 specifies the path in below figure 例如, index path 1.4.3.2在下图中指定了路径 在此处输入图片说明

for more info https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/ 有关更多信息https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/

NSIndexpath holds typically integer values referred to as index values . NSIndexpath通常保存称为索引值的 数值 These index values are wrapped up in the NSIndexPath object in some logical way so as they can be interpreted accordingly. 这些索引值以某种逻辑方式包装在NSIndexPath对象中,以便可以对其进行相应的解释。

Example could be you require a multi-dimensional array and need to keep track of the index path to a particular element. 例如,您可能需要一个多维数组,并且需要跟踪到特定元素的索引路径。

For iOS refer to NSIndexPath UIKit Additions 对于iOS,请参阅NSIndexPath UIKit添加

NSIndexPath holds an ordered list of integers referring a path through a tree. NSIndexPath保存有序的整数列表,这些整数引用通过树的路径。

0 entry
  0 subentry 1
  1 subentry 2
1 another entry
  0 subentry of another entry
    0 subsubentry
    1 another subsubentry
  1 another subentry of another entry

I. e. "another subsubentry" has the path 1.0.1. “另一个子条目”的路径为1.0.1。

We use NSIndexPath most commonly in UITableView methods to get section number and row number of current or selected index.If we go as an example of UITableView case it holds all section numbers in an array and holds all rows in different arrays based on number of items in section array. 我们在UITableView方法中最常用NSIndexPath来获取当前或选定索引的节号和行号。如果以UITableView的情况为例,它将所有节号保存在数组中,并根据项目数将所有行保存在不同数组中在节数组中。 each section has sub array that contains rows of that section. 每个部分都有包含该部分行的子数组。

For more have a look at NSIndexPath 有关更多信息,请查看NSIndexPath

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 iOS 表视图中的“NSIndexPath *”类型的对象上找不到属性“行” - property 'row' not found on object of type 'NSIndexPath *' in iOS tableview 我们可以将NSURLRequest直接存储到Core Data中吗? - Can we store NSURLRequest directly into Core Data? 无法将'NSIndexPath'类型的值转换为预期的参数类型'NSIndexPath' - Cannot convert value of type 'NSIndexPath' to expected argument type 'NSIndexPath' NSIndexPath:从CoreData检索数据 - NSIndexPath: retrieving data from CoreData 您可以将NSIndexPath转换为NSInterger吗 - Can you downcast a NSIndexPath to NSInterger 无法使用Int类型下标类型'[NSIndexPath]'的值 - Cannot subscript a value of type '[NSIndexPath]' with a type Int 我们可以使用核心数据来存储房地产吗? - can we use core data to store a real estate property? 我们在iOS中使用SqlCipher存储数据时可以使用CoreData管理离线数据吗 - can we use CoreData to manage offline data when we use SqlCipher to store data in iOS 我应该使用什么数据类型在Core Data中存储GUID? - What data type should I use to store a GUID in Core Data? 无法在 Swift 中将“UITableViewCell”类型的值转换为“NSIndexPath” - Could not cast value of type 'UITableViewCell' to 'NSIndexPath' in Swift
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM