Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
- Subject: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
- From: Jonathan Hess <email@hidden>
- Date: Mon, 17 Nov 2008 21:44:56 -0800
I simply don't need properties for all my Outlets, except for this
issue. I also don't really like making all my outlets implicitly
public. But I'm forced to do that.
Here's one way to avoid making your outlets public:
// Header
@interface MyClass : NSObject {
@private
IBOutlet UILabel *myLabel;
}
@end
// Implementation
@implementation MyClass
- (void)setMyLabel:(UILabel *)myLabel {
myLabel = label;
}
@end
You get non-retained outlets, and it's still explicit and obvious. You
can create many other variations of this. For example, you can use
@property and @synthesize in only the implementation file. The most
important thing to remember is that IB calls setValue:forKeyPath: with
a key path that is equal to the name of your outlet. You can read
about key value coding here: http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/KeyValueCoding.html
Compiled in mail -
Jon Hess
_______________________________________________
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