How to deal with callback to your UIController after your UIController unloads?

Posted by erotsppa on Stack Overflow See other posts from Stack Overflow or by erotsppa
Published on 2010-04-22T15:39:59Z Indexed on 2010/04/22 15:43 UTC
Read the original article Hit count: 191

Filed under:
|

Suppose your controller is a table view and one of the cells you are going off to do a length task (say download a thumbnail) to be viewed in the cell. Typically you would have the network call do a callback to your controller when it is done downloading. The callback can then reload the table or do some other form of UI update (hides a spinner etc).

However, what if the controller is unloaded? Say the user navigated away from this controller and it got released? What happens? Will the callback still work despite the controller now not in memory? Also, if the callback operates on some objects (say the UITableView) what happens when the controller is deallocated? I suppose the controller can release all the objects and the callback would just be calling methods on nil to prevent crash. But is this the convention?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk