> Parts of your first question remind me of a situation that I had. Erik Buck > gave me some great advice and part of it was the following:
> If you are worried about adding drawing code to a "Model" object, add the > drawing code in a category of <the model object>* and maintain the category > implementation in the "View" subsystem. > *I changed the words he used here because he used the name of my specific > class and I wanted to make it more readable in the general case. > This will let you put a category into every view that you want to so that > your model objects get handled correctly for each view. This may be indeed a good idea to use categories for this purpose. Is it what everybody is using? I have only one problem with this approach: As I mentioned before, I need to add custom-view specific instance variables (states) to the model object's category. The Objective-C categories do not allow adding instance variables, only methods I am considering to create a dictionary owned by the custom view, containing state objects keyed by model object unique ID. This is a kind of surrogate of subclassing the model objects inside the custom view. I am not sure this is a good idea though. Are there other approaches? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]