【发布时间】:2012-05-12 15:29:56
【问题描述】:
我正在使用 ARC,并希望创建一个通过引用传入 indexPath 的方法,以便我可以更改其值:
-(void)configureIndexPaths:(__bridge NSIndexPath**)indexPath anotherIndexPath:(__bridge NSIndexPath**)anotherIndexPath
{
indexPath = [NSIndexPath indexPathForRow:*indexPath.row + 1 inSection:0];
anotherIndexPath = [NSIndexPath indexPathForRow:*anotherIndexPath.row + 1 inSection:0];
}
但这给了我一个未找到属性行的错误。我该如何解决这个问题。
还有另一个概念性问题:如果我的目标只是更改传入方法的 indexPath 的值,难道不能通过指针传递吗?为什么我会选择引用传递而不是指针传递?
【问题讨论】:
-
为什么不让方法返回一个新的 nsindexpath?
-
我传入了两个我想要更改的唯一 indexPaths
-
newIndexPath 是单独的索引路径
-
我一直认为双指针是 __autoreleasing,而不是 __bridge...
标签: objective-c ios automatic-ref-counting