A
UITableView
is a vertical list of items or rows.
Each row consists of a
UITableViewCell
object containing a
line
of text
or an
image,
and maybe a
checkmark.
A table view may be divided into sections; see the one in the Settings app under General. To identify a cell we need to know its section number, and its row number within that section. Both numbers are zero-based. For example, a table view that is not divided into sections is treated as one big section whose section number is 0.
An
NSIndexPath
contains a pair of properties giving the section number,
and the row number within that section,
of a
UITableViewCell
.
Since the numbers are
NSInteger
s,
we print them with the
%d
format.
These properties,
section
and
row
,
were not part of the basic
NSIndexPath
class.
They were added to it as part of a
category.
In
Tree
,
we will take advantage of the fact that an
NSIndexPath
can hold more than two numbers.
When we do this, the numbers are conventionally separated by periods:
10.20.30.40.50
.
These numbers are
NSUInteger
s,
so we print them with the
%u
format.
2013-08-08 17:05:54.612 Path[67997:c07] section == 20 2013-08-08 17:05:54.615 Path[67997:c07] row == 10 2013-08-08 17:05:54.616 Path[67997:c07] index 0 == 10 2013-08-08 17:05:54.616 Path[67997:c07] index 1 == 20 2013-08-08 17:05:54.616 Path[67997:c07] index 2 == 30 2013-08-08 17:05:54.617 Path[67997:c07] index 3 == 40 2013-08-08 17:05:54.617 Path[67997:c07] index 4 == 50 2013-08-08 17:05:54.617 Path[67997:c07] 2013-08-08 17:05:54.618 Path[67997:c07] index 0 == 10 2013-08-08 17:05:54.618 Path[67997:c07] index 1 == 20 2013-08-08 17:05:54.618 Path[67997:c07] index 2 == 30 2013-08-08 17:05:54.619 Path[67997:c07] index 3 == 40 2013-08-08 17:05:54.619 Path[67997:c07] index 4 == 50 2013-08-08 17:05:54.619 Path[67997:c07] index 5 == 60