【发布时间】:2014-07-08 05:25:53
【问题描述】:
出于某种目的,我正在尝试存储选定的索引路径。下面是我在cellForRowAtIndexpath: 中执行的代码
if ([_arrOfIndexPaths containsObject:indexPath]) {
[filterCell setAccessoryType:UITableViewCellAccessoryCheckmark];
[filterCell.textLabel setFont:[UIFont boldSystemFontOfSize:filterCell.textLabel.font.pointSize]];
}
当我尝试打印以下行的描述时,会打印出来。
<__NSArrayM 0x91567d0>(
<NSIndexPath: 0x8e8b5b0> {length = 2, path = 0 - 0},
<NSIndexPath: 0x91559a0> {length = 2, path = 2 - 0}
)
Printing description of indexPath:
<NSIndexPath: 0x91a8460> {length = 2, path = 0 - 0}
如果您看到数组中没有的实例描述 0x91a8460。 但仍然条件成功。有人可以解释一下这是如何工作的。提前致谢。
【问题讨论】:
-
阅读
containsObject:方法的文档。将对象与对isEqual:的调用进行比较。
标签: ios cocoa-touch nsarray nsindexpath