Graphics Programs Reference
In-Depth Information
toIndex:[destinationIndexPath row]];
}
Build and run your application. Check out the new reordering controls (the three horizont-
al lines) on the side of each row. Touch and hold a reordering control and move the row to
a new position (
Figure 10.8
)
.
Figure 10.8 Moving a row
Note that simply implementing
tableView:moveRowAtIndexPath:toIndexPath:
caused the reordering con-
trols to appear. This is because Objective-C is a very smart language. The
UIT-
ableView
can ask its data source at runtime whether it implements
tableView:moveRowAtIndexPath:toIndexPath:
. If it does, the table view
says, “Good, you can handle moving rows. I'll add the re-ordering controls.” If not, it