Under a table view delegate, indexPath
is sent. Is it possible to assign this to a local variable and then adjust it? I didn't see anything in the class reference docs.
What I'm trying to do is add 1 to the indexPath.row
.
This code doesn't work, but I'm putting it here to get the basic idea across.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSIndexPath *tempIndex;
tempIndex = indexPath;
tempIndex.row = tempI开发者_StackOverflowndex.row + 1;
//etc...
}
Thanks in advance
You can get another NSIndexPath by calling
NSIndexPath *tempIndex = [NSIndexPath indexPathForRow:indexPath.row + 1 inSection:indexPath.section];
Although I don't understand what you mean by "adjusting" it. Typically, in cellForRowAtIndexPath
, you don't work with other paths/cells that the one which is asked for.
精彩评论