indexPath.item vs indexPath.row

Inside NSIndexPath, the indexes are stored in a simple c array called “_indexes” defined as NSUInteger* and the length of the array is stored in “_length” defined as NSUInteger. The accessor “section” is an alias to “_indexes[0]” and both “item” and “row” are aliases to “_indexes[1]”. Thus the two are functionally identical.
In terms of programming style – and perhaps the definition chain – you would be better using “row” in the context of tables, and “item” in the context of collections.

Posted in iOS


您的电子邮箱地址不会被公开。 必填项已用*标注