ios - NSIndexpath.item 与 NSIndexpath.row

标签 ios uitableview nsindexpath

有人知道 NSIndexpath.rowNSIndexpath.item 之间的区别吗?

具体来说,我使用哪一个:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

最佳答案

好吧,这里没有人给出好的答案。

在 NSIndexPath 内部,索引存储在一个名为“_indexes”的简单 C 数组中,定义为 NSUInteger*,数组的长度存储在定义为 NSUInteger* 的“_length”中。访问器“section”是“_indexes[0]”的别名,“item”和“row”都是“_indexes[1]”的别名。因此两者在功能上是相同的。

就编程风格(也许还有定义链)而言,您最好在表的上下文中使用“行”,在集合的上下文中使用“项目”。

关于ios - NSIndexpath.item 与 NSIndexpath.row,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57584068/

相关文章:

swift - tableView.cellForRowAtIndexPath(indexPath) 返回 nil

ios - NSIndexPath:从 CoreData 检索数据

ios - 如何存储 [String : UIImage] into CoreData/UserDefaults? 类型的字典

ios - 如何从 Xamarin IOS 获取唯一的 DeviceID

ios - 核心数据 : Delete the last entity with one to many relationship

iOS tableview 如何检查它是向上还是向下滚动

ios - TableView滚动时如何避免UITableViewCell重复添加自定义标签?

ios - 如何在TableView下面添加View?

iphone - 具有不同值的 TableView 委托(delegate)方法中的索引路径

ios - 如何在 swift(反射/镜像)中动态找到属性的类型?