Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.4 and later. |
Declared in | NSIndexPath.h |
The NSIndexPath
class represents the path to a specific node in a tree of nested array collections. 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 shown in Figure 1.
NSIndexPath
objects are uniqued and shared. If an index path containing the specified index or indexes already exists, that object is returned instead of a new instance.
Creates an one-node index path.
+ (id)indexPathWithIndex:(NSUInteger)index
Index of the item in node 0 to point to.
One-node index path with index.
NSIndexPath.h
Creates an index path with one or more nodes.
+ (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length
Array of indexes to make up the index path.
Number of nodes to include in the index path.
Index path with indexes up to length.
NSIndexPath.h
Indicates the depth-first traversal order of the receiver and another index path.
- (NSComparisonResult)compare:(NSIndexPath *)indexPath
Index path to compare.
This value must not be nil
. If the value is nil
, the behavior is undefined and may change in future versions of Mac OS X.
The depth-first traversal ordering of the receiver and indexPath.
NSOrderedAscending
: The receiver comes before indexPath.
NSOrderedDescending
: The receiver comes after indexPath.
NSOrderedSame
: The receiver and indexPath are the same index path.
NSIndexPath.h
Provides a reference to the receiver’s indexes.
- (void)getIndexes:(NSUInteger *)indexes
Pointer to an unsigned integer array. On return, the receiver indexes.
NSIndexPath.h
Provides the index at a particular node in the receiver.
- (NSUInteger)indexAtPosition:(NSUInteger)node
Index value of the desired node. Node numbering starts at zero.
Index value at node.
NSIndexPath.h
Provides an index path containing the indexes in the receiver and another index.
- (NSIndexPath *)indexPathByAddingIndex:(NSUInteger)index
Index to append to the receiver’s indexes.
New NSIndexPath
object containing the receiver’s indexes and index.
NSIndexPath.h
Provides an index path with the indexes in the receiver, excluding the last one.
- (NSIndexPath *)indexPathByRemovingLastIndex
New index path with the receiver’s indexes, excluding the last one.
Returns an empty NSIndexPath
instance if the receiver’s length is 1 or less.
On Mac OS X 10.4 and earlier this method returns nil
when the length of the receiver is 1 or less. On Mac OS X 10.5 and later this method will never return nil
.
NSIndexPath.h
Initializes an allocated NSIndexPath
object with a one-node index path.
- (id)initWithIndex:(NSUInteger)index
Index of the item in node 0 to point to.
Initialized NSIndexPath
object representing a one-node index path with index.
NSIndexPath.h
Initializes an allocated NSIndexPath
object with an index path of a specific length.
- (id)initWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length
Array of indexes to make up the index path.
Number of nodes to include in the index path.
Initialized NSIndexPath
object with indexes up to length.
NSIndexPath.h
Provides the number of indexes in the receiver.
- (NSUInteger)length
Number of indexes in the receiver.
NSIndexPath.h
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)