Delete/move a UITableView row that's attached to a web service.

Posted by Kevin L. on Stack Overflow See other posts from Stack Overflow or by Kevin L.
Published on 2010-12-16T02:06:29Z Indexed on 2011/01/11 8:53 UTC
Read the original article Hit count: 159

Deleting or moving rows for a UITableView that is backed with local data (e.g., NSArray) is easy and instantaneous:

  1. Remove the value from the array.
  2. Call deleteRowsAtIndexPaths:withRowAnimation:.
  3. 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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about web-services