Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 是否可以调整indexPath?_Iphone_Objective C_Xcode - Fatal编程技术网

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是不可变的。