When to release the model(representedObject) of the corresponding UIViewController.

Posted by user313786 on Stack Overflow See other posts from Stack Overflow or by user313786
Published on 2010-04-11T06:27:56Z Indexed on 2010/04/11 6:33 UTC
Read the original article Hit count: 356

Hi, In AppKit we have "representedObject" available through NSViewController, this representedObject is generally set to ModelController or the model which the NSViewController displays, this works great with bindings as you just set the new representedObject and model details are updated in the view, BUT in case of iPhone (UIKit, with NO Cocoa bindings available), there is no such representedObject in UIViewController so here are few things I am interested in knowing:-

  1. What is the best/recommended way of binding the model to the UIViewController?, preferably dont want to maintain lot of IBOutlets and calls setters to updated the changed model data for display in view.
  2. How/When should the related model of the UIViewController be released?
  3. When is the -[UIViewController dealloc] called, in the typical iPhone application.

Am looking for architecting some classes so that the UIViewController coordinates between the view and the model, but at the same time, deallocs the model when ever not necessary.

TIA.

© Stack Overflow or respective owner

Related posts about cocoa-design-patterns

Related posts about cocoa-bindings