Up

# NSIndexPath class documentation

### Authors

Richard Frith-Macdonald (`rfm@gnu.org`)

Copyright: (C) 2006 Free Software Foundation, Inc.

# Software documentation for the NSIndexPath class

## NSIndexPath : NSObject

> Declared in:
>   Foundation/NSIndexPath.h

> Conforms to:
>   NSCopying
>   NSCoding

Availability: MacOS-X 10.4.0, Base 1.2.0
Instances of this class represent a series of indexes into a hierarchy of arrays.
Each instance is a unique shared object.
Method summary

- +indexPathForItem:inSection:
- +indexPathForRow:inSection:
- +indexPathWithIndex:
- +indexPathWithIndexes:length:
- -compare:
- -getIndexes:
- -indexAtPosition:
- -indexPathByAddingIndex:
- -indexPathByRemovingLastIndex
- -initWithIndex:
- -initWithIndexes:length:
- -item
- -length
- -section

### indexPathForItem: inSection:

+ (NSIndexPath*) indexPathForItem: (NSInteger)item inSection: (NSInteger)section;
Availability: Not in OpenStep/MacOS-X, Base 1.2.0
Return a path containing an item number and section.

### indexPathForRow: inSection:

+ (NSIndexPath*) indexPathForRow: (NSInteger)row inSection: (NSInteger)section;
Availability: Not in OpenStep/MacOS-X, Base 1.2.0
Return a path containing row number and section.

### indexPathWithIndex:

+ (id) indexPathWithIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.4.0, Base 1.2.0
Return a path containing the single value anIndex.

### indexPathWithIndexes: length:

+ (id) indexPathWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length;
Availability: MacOS-X 10.4.0, Base 1.2.0
Return a path containing all the indexes in the supplied array.

### compare:

- (NSComparisonResult) compare: (NSIndexPath*)other;
Availability: MacOS-X 10.4.0, Base 1.2.0
Compares other with the receiver.
Returns NSOrderedSame if the two are identical.
Returns NSOrderedAscending if other is less than the receiver in a depth-wise comparison.
Returns NSOrderedDescending otherwise.

### getIndexes:

- (void) getIndexes: (NSUInteger*)aBuffer;
Availability: MacOS-X 10.4.0, Base 1.2.0
Copies all index values from the receiver into aBuffer.

### indexAtPosition:

- (NSUInteger) indexAtPosition: (NSUInteger)position;
Availability: MacOS-X 10.4.0, Base 1.2.0
Return the index at the specified position or NSNotFound if there is no index at the specified position.

### indexPathByAddingIndex:

- (NSIndexPath*) indexPathByAddingIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.4.0, Base 1.2.0
Return path formed by adding anIndex to the receiver.
Return path formed by adding the index to the receiver.

### indexPathByRemovingLastIndex

- (NSIndexPath*) indexPathByRemovingLastIndex;
Availability: MacOS-X 10.4.0, Base 1.2.0
Return path formed by removing the last index from the receiver.

### initWithIndex:

- (id) initWithIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.4.0, Base 1.2.0
This is a designated initialiser for the class.
Returns the shared instance containing the specified index, creating it and destroying the receiver if necessary.

### initWithIndexes: length:

- (id) initWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length;
Availability: MacOS-X 10.4.0, Base 1.2.0
This is a designated initialiser for the class.
Returns the shared instance containing the specified index array, creating it and destroying the receiver if necessary.
Initialise the receiver to contain the specified indexes.
May return an existing index path.

### item

- (NSInteger) item;
Availability: Not in OpenStep/MacOS-X, Base 1.2.0
Return an index number identifying a row in a table view

### length

- (NSUInteger) length;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns the number of index values present in the receiver.

### section

- (NSInteger) section;
Availability: Not in OpenStep/MacOS-X, Base 1.2.0
Return an index number identifying a section in a collection view

Up