• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Interface Builder & Wiring Objects (From: Greg Deward <email@hidden>)
 >Re: Interface Builder & Wiring Objects (From: Randall Meadows <email@hidden>)
 >Re: Interface Builder & Wiring Objects (From: Greg Deward <email@hidden>)
 >Re: Interface Builder & Wiring Objects (From: Andy Lee <email@hidden>)
 >Re: Interface Builder & Wiring Objects (From: mmalcolm crawford <email@hidden>)
 >Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects) (From: mmalcolm crawford <email@hidden>)
 >Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects) (From: Brian Stern <email@hidden>)
 >Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects) (From: mmalcolm crawford <email@hidden>)
 >Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects) (From: Brian Stern <email@hidden>)

  • Prev by Date: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
  • Next by Date: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
  • Previous by thread: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
  • Next by thread: Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)
  • Index(es):
    • Date
    • Thread