Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C++, class scope constants, name conflicts



On Feb 10, 2006, at 5:34 PM, Scott Ribe wrote:

Of course the coupling is undesirable, but as far as I know, Cocoa offers me
NO WAY to change that number of controls in a nib without changing code in
my controller. (And it certainly doesn't offer me a path to add controls
without remembering to connect them all properly.)

It does: You can use bindings, or you can create your own bindings- like system that uses key paths and your own controller objects to connect your view with your model.


You call out checking groups of controls for valid data as a significant use case; you have said you don't want to write redundant code to do this. I would probably use bindings to connect my view and model objects, and implement key-value validation methods on my model objects as appropriate. That way the validation is happening at the model rather than the view level, and code-level coupling of view and model is minimized.

For one example, if I was going to present identical controls for several objects in a collection, I might create a custom view that knew how to interact with an array controller and present one set of controls for each object in the array controller's arranged objects.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Objective-C++, class scope constants, name conflicts (From: Scott Ribe <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.