Shane wrote:

So I guess my question is, how do I make sure my view is able to
receive the data I want sent to it before it is ever displayed. I hope
that makes sense.


Send the data to a Model, not a View. If the View and Model are the same object, then the only way to have a Model is to have a View.

If you separate View from Model, then you can create a Model once (or whenever it's needed), and send it any data. It then provides its data to any View that wants it, whenever the View wants it (typically, initialize the View from the Model's data in awakeFromNib). If the View goes away (dealloc'ed), the Model remains. Or if the Model represents a Document, the Model goes away, too.

To start making a separate Model, go through your View and ViewController classes and decide whether each method, property, or stateful item is part of the logical structure or the visible structure. Logical structure is what the program represents regardless of how it's presented. Visible structure is graphics, windows, etc. If you change something in the logical structure, the program's capabilities change. If you change something in the visible structure, that changes how it looks, but the capabilities are the same.

Example: you can have a huge visible structure consisting of dialogs, palettes, pickers, etc. for setting and applying a font to a single string of text. The logical structure is much simpler: there is a chosen font and there is a single string the font is applied to. The Model has a string and a font. Everything else is part of the View and/or ViewController.

  -- GG

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to