Delete/move a UITableView row that's attached to a web service.
- by Kevin L.
Deleting or moving rows for a UITableView that is backed with local data (e.g., NSArray) is easy and instantaneous:
Remove the value from the array.
Call deleteRowsAtIndexPaths:withRowAnimation:.
Profit!
But my table view communicates with a web service, which means once the "Delete" button on that row gets tapped, I have to forward a request on to the server (via ASIHTTPRequest, of course), get the response, and then tell the table view to run its little delete-row animation, all with a few seconds of latency in between.
From a high-level, what's the best way to do that? Throw some callback selector into ASIHTTPRequest's userInfo dictionary? KVO?
Bonus points for some nice UI touch, like some kind of spinner on the soon-to-be-deleted cell.