NSIndexPath UIKit Additions
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/UIKit.framework |
| Availability | Available in iOS 2.0 and later. |
| Companion guide | |
| Declared in | UICollectionView.h UITableView.h |
Overview
The UIKit framework adds programming interfaces to the NSIndexPath class of the Foundation framework to facilitate the identification of rows and sections in UITableView objects and the identification of items and sections in UICollectionView objects.
The API consists of class factory methods and properties for accessing the various indexed values. You use the factory methods to create an index path for the corresponding table view or collection view.
Tasks
Creating an Index Path Object
Getting the Section Index
-
sectionproperty
Getting the Index of a Row or Item
Properties
item
An index number identifying an item in a section of a collection view. (read-only)
Discussion
The section the item is in is identified by the value of section.
Availability
- Available in iOS 6.0 and later.
Declared In
UICollectionView.hrow
An index number identifying a row in a section of a table view. (read-only)
Discussion
The section the row is in is identified by the value of section.
Availability
- Available in iOS 2.0 and later.
Declared In
UITableView.hsection
An index number identifying a section in a table view or collection view. (read-only)
Availability
- Available in iOS 2.0 and later.
Declared In
UITableView.hClass Methods
indexPathForItem:inSection:
Returns an index-path object initialized with the indexes of a specific item and section in a collection view.
Parameters
- item
An index number identifying an item in a
UICollectionViewobject in a section identified by the section parameter.- section
An index number identifying a section in a
UICollectionViewobject.
Return Value
An NSIndexPath object or nil if the object could not be created.
Availability
- Available in iOS 6.0 and later.
Declared In
UICollectionView.hindexPathForRow:inSection:
Returns an index-path object initialized with the indexes of a specific row and section in a table view.
Parameters
- row
An index number identifying a row in a
UITableViewobject in a section identified by section.- section
An index number identifying a section in a
UITableViewobject.
Return Value
An NSIndexPath object or nil if the object could not be created.
Availability
- Available in iOS 2.0 and later.
Declared In
UITableView.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)