Iphone 是否可以调整indexPath?
在表视图委托下,发送Iphone 是否可以调整indexPath?,iphone,objective-c,xcode,Iphone,Objective C,Xcode,在表视图委托下,发送indepath。是否可以将其分配给局部变量,然后进行调整?我在课堂参考文档中没有看到任何东西 我试图做的是将1添加到indexPath.row 这段代码不起作用,但我把它放在这里是为了让大家了解基本的想法 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSIndexPath *tempIndex;
indepath
。是否可以将其分配给局部变量,然后进行调整?我在课堂参考文档中没有看到任何东西
我试图做的是将1添加到indexPath.row
这段代码不起作用,但我把它放在这里是为了让大家了解基本的想法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSIndexPath *tempIndex;
tempIndex = indexPath;
tempIndex.row = tempIndex.row + 1;
//etc...
}
提前感谢您可以通过拨打
NSIndexPath *tempIndex = [NSIndexPath indexPathForRow:indexPath.row + 1 inSection:indexPath.section];
虽然我不明白你说的“调整”是什么意思。通常,在
cellforrowatinexpath
中,您不能使用请求的其他路径/单元格。您可以通过调用
NSIndexPath *tempIndex = [NSIndexPath indexPathForRow:indexPath.row + 1 inSection:indexPath.section];
虽然我不明白你说的“调整”是什么意思。通常,在cellforrowatinexpath
中,您不能使用请求的其他路径/单元格。NSIndexPath是不可变的。nsindepath是不可变的。