NSIndexPath row and item properties for row and section

Seems obvious when you use it but this can be a little puzzling.

Firstly, there is now row or item property on NSIndexPath. So, what’s going on?

If you take a closer look at the NSIndexPath documentation you’ll see that iOS adds the row and item properties in UIKit.

In full:

Note: iOS adds programming interfaces to the NSIndexPath class of the Foundation framework to facilitate the identification of rows and sections in UITableView objects. The API consists of a class method and two properties. The indexPathForRow:inSection: method creates an NSIndexPath object from row and section index numbers. The properties return the row index number and the section index number from such objects. See NSIndexPath UIKit Additions for details.

And these class methods and properties are:

Creating an Index Path Object:
+ indexPathForRow:inSection:
+ indexPathForItem:inSection:
Getting the Section Index:
section  property
Getting the Index of a Row or Item
row  property
item  property


Leave a Reply

Your email address will not be published. Required fields are marked *