Search This Blog

Wednesday, December 15, 2010

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

Programmer Question

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.



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails