Re: Mental block targeting GUI items programatically
Re: Mental block targeting GUI items programatically
- Subject: Re: Mental block targeting GUI items programatically
- From: Olivier Scherler <email@hidden>
- Date: Tue, 19 Apr 2005 10:09:57 +0200
> I'm sure this is a simple one, but I'm having a bit of trouble
> wrapping my head around how exactly to programatically send messages
> to a custom view in a window.
>
> I wrote a custom view class, imported it into InterfaceBuilder and
> selected it in the "Custom class" popup and got stuck. The class has
> an "addSubviews:(NSArray *) inArray" method which will only be
> updated by a daemon. Since it lives in the nib file, and is loaded
> without any action by me, how do I get a reference so messages can be
> sent to it? Do I need an IBOutlet somewhere? A delegate? An awake
> from nib? Would a Binding be the best route?
In the class that needs the reference to the view (that would be the
controller), you add an IBOutlet:
IBOutlet YourCustomView *theView;
Then in Interface Builder, you control-drag from the controller to the view. THe
inspector appears, displaying COnections -> Outlets and you can select theView
in the outlet list.
You need to have imported the header file of your controller and instanciated it
(via the Classes menu in IB while displaying the Classes tab in the main NIB
window.)
Olivier
∞ Unicode ribbon campaign — No ASCII, anywhere ∞
∞ <http://ithink.ch/unicode> ∞
:: Olivier Scherler :: Neuchâtel (CH) :: <http://ithink.ch/blog/> ::
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden