• 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: Using dot syntax for non-@property properties?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using dot syntax for non-@property properties?


  • Subject: Re: Using dot syntax for non-@property properties?
  • From: Andre <email@hidden>
  • Date: Wed, 7 Nov 2007 14:32:42 +0900


On 平成 19/11/07, at 11:32, Ali Ozer wrote:

You can declare a property in a category, like so:

@interface NSView (Properties)
@property (assign) NSRect bounds;
@end

@interface NSView (Properties)
@dynamic bounds;
@end

As long as there is a <key> and set<key> method pair, you can "tack" on a property.
I've done it for some pre-leopard objects such as a subviews property etc on NSView...

You don't need to tack on an explicit property declaration. The dot- syntax will work for any getter/setter pair, as long as the receiving object is statically typed. In the original example, sender is declared as "id," so it doesn't work.
Thats nice to know. Thanks.

Andre


Ali



_______________________________________________

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: 
 >Using dot syntax for non-@property properties? (From: Joshua Emmons <email@hidden>)
 >Re: Using dot syntax for non-@property properties? (From: email@hidden)
 >Re: Using dot syntax for non-@property properties? (From: Ali Ozer <email@hidden>)

  • Prev by Date: Re: Leopard problem: rotating buttons
  • Next by Date: Re: vibrating window
  • Previous by thread: Re: Using dot syntax for non-@property properties?
  • Next by thread: vibrating window
  • Index(es):
    • Date
    • Thread