views:

27

answers:

1

Hello,

Sorry if this question has all ready been asked, maybe someone can point me in the right direction, I had trouble formatting it.

I have a view controller, when it appears an NSURLConnection loads remote data asynchronously from a server into a table view, similar to how the Mail application loads data. However I also want to be able to delete this data within the same view, similar to how the Mail application deletes data.

What is the best way to handle multiple connection delegates? Should I have a separate delegate classes for loading and deleting? And at what point in my code do I call deleteRowsAtIndexPath to properly reflect the changes?

A: 

One way to identify the connection is to keep an ivar in your view controller that references each connection.

The NSURLConnection delegate methods include a parameter that identifies the connection that the method call refers to, so you just need compare the connection parameter with your ivars to determine which connection it is for.

Avalanchis