RS: getting at a class instance created by IB
RS: getting at a class instance created by IB
- Subject: RS: getting at a class instance created by IB
- From: Roland Silver <email@hidden>
- Date: Mon, 21 May 2007 15:00:24 -0600
Say I have a class Foo created and instantiated by Interface Builder.
What's a good way for other code in my project to invoke instance
methods in Foo?
The best I can think of is this:
(1) to have a class variable for Foo:
Foo* bar;
(2) to have a class method
+(Foo*)getFoo {
return bar;
}
(3) to have an awakeFromNib method in Foo, which executes:
bar = self;
Then outside the class, a Foo instance method fubar can be invoked by
[[Foo getFoo] fubar];
Anything simpler?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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