• 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: What's the point of @properties?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the point of @properties?


  • Subject: Re: What's the point of @properties?
  • From: Ken Ferry <email@hidden>
  • Date: Wed, 22 Sep 2010 17:06:06 -0700

On Wed, Sep 22, 2010 at 12:43 PM, Matt Neuburg <email@hidden> wrote:

> On Wed, 22 Sep 2010 15:16:19 +0200, Uli Kusterer
> <email@hidden> said:
> > One point nobody mentioned so far: You can use different names for your
> public
> property (e.g. an IBOutlet) and your internal storage (i.e. the instance
> variable). I like to avoid name collisions between local variables and
> instance
> variables by using an m prefix on instance variables. Using @synthesize
> cancelButton = mCancelButton;, I can do that.
> >
> > Instead of declaring the instance variable as an IBOutlet, I can now
> declare
> >
> >@property (retain) IBOutlet NSButton*    cancelButton;
> >
> > and IB will call setCancelButton:, not setMCancelButton:, which wasn't
> possible without properties.
>
> Not so. If an outlet in IB is called "cancelButton",


…but previously you could only make an IBOutlet called cancelButton by
having an ivar called cancelButton.

If you really wanted to you could #ifdef the variable out and IB would still
pay attention, but that's just weird.

-Ken


> nib-loading will call
> setCancelButton: if it exists, and of course setCancelButton: can be a
> front
> for anything at all; no instance variable need exist, in fact, let alone
> one
> having the same name. m.
>
> --
> matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings
>
>
>
> _______________________________________________
>
> 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
>
_______________________________________________

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

  • Follow-Ups:
    • Re: What's the point of @properties?
      • From: Matt Neuburg <email@hidden>
References: 
 >Re: What's the point of @properties? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: NSOperation and threadDictionary
  • Next by Date: Re: NSOperation and threadDictionary
  • Previous by thread: Re: What's the point of @properties?
  • Next by thread: Re: What's the point of @properties?
  • Index(es):
    • Date
    • Thread