Re: Neophyte Question: Connecting to nib objects
Re: Neophyte Question: Connecting to nib objects
- Subject: Re: Neophyte Question: Connecting to nib objects
- From: Mark Ritchie <email@hidden>
- Date: Mon, 19 Oct 2009 09:11:57 -0700
On 19-Oct-2009, at 8:51 AM, Phil Hystad wrote:
Given that I have an object defined in the nib (aka xib), for
example, an object that responds to a given view, what is the
correct way for my running application (if it is in some other
state, not responding to an action) to obtain a pointer to that
object.
The "File's Owner" is what you're after!
The docs are here:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW15
Maybe a second question is "Do I ever need to do this?".
Yes, yes, yes and yes! ;-)
Some examples:
1) initialization of state so that objects from a nib file are in sync
with your controller
2) state updates
3) enable/disable of optional UI components
4) dynamic changes to the UI which could not be foreseen before runtime.
etc, etc
Regards!
M.
_______________________________________________
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