Re: Enumerating outlets automatically?
Re: Enumerating outlets automatically?
- Subject: Re: Enumerating outlets automatically?
- From: Andy Lee <email@hidden>
- Date: Thu, 6 Nov 2008 14:16:54 -0500
On Nov 6, 2008, at 12:50 PM, Michael Ash wrote:
On Thu, Nov 6, 2008 at 12:15 PM, Andy Lee <email@hidden> wrote:
Lastly, you could write a proxy object, put it in your nib, and hook
up all of the outlets to it instead. The proxy would intercept all
setFoo: messages by forwarding them to your real object and
simultaneously building a dictionary. This will be sure to only get
real outlets.
I'm not sure I understand -- would the proxy object have outlets to
myOutlet1, myOutlet2, etc.?
It wouldn't have outlets in the sense of IBOutlet ivars declared in
the header. You would, however, "lie" to IB and tell it that it did
have all the outlets you want to manage, then connect them. You would
then implement forwarding like so (not tested, buyer beware, etc.):
Ah, I see. When you said setFoo: I was thinking of the setEnabled:
message that Graham wanted to send to all the objects, but you meant
the setMyOutlet1:, setMyOutlet2:, etc. messages that are (we think)
sent when the nib is loaded.
It seems to me that all solutions other than trying to automatically
figure out the outlets (and this includes Erik Buck's suggestion to
add an array to the nib) are essentially variations on manually
specifying the dictionary. Given that choice, I guess I'd prefer
just... manually specifying the dictionary. It's very quick and
transparent, and omissions are easier to spot than in IB.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden