Get a tableview insertRowsAtIndexPaths to accept indexOfObject?
Posted
by Emil
on Stack Overflow
See other posts from Stack Overflow
or by Emil
Published on 2010-04-30T20:28:32Z
Indexed on
2010/04/30
21:17 UTC
Read the original article
Hit count: 419
Hey.
I have a code snippet that looks like this:
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[array indexOfObject:[array objectAtIndex:indexPath.row]]] withRowAnimation:UITableViewRowAnimationLeft];
[tableView endUpdates];
[tableView reloadData];
It gets executed when a user clicks on an accessory. The first part is only there to provide a smooth animation, and does not really matter, as the tableView is reloaded milliseconds later, but as I said, it's there to provide an animation.
It is supposed to move a selected object from its current indexPath to the value from an array at the same indexPath.
Obviously, this code does not work, so I just want to know what can be done to fix it?
PS: I get a warning when compiling, too. The usual "passing argument 1 of 'arrayWithObject:' makes pointer from integer without a cast..." (line 3)
© Stack Overflow or respective owner