• 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
Subclassing NSControl and inheritance of target, action properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing NSControl and inheritance of target, action properties


  • Subject: Subclassing NSControl and inheritance of target, action properties
  • From: Graham Cox <email@hidden>
  • Date: Fri, 30 Jan 2015 10:44:19 +1100

NSControl has properties target, action.

I want to subclass NSControl but my custom control doesn't use a cell internally. I want to inherit the target, action properties so that I can hook these up for my custom subclass in IB (If I don't inherit NSControl, IB is unaware that I have target, action properties that can be connected in the usual way). The standard control class actually implements the storage for these properties in its cell, so if I don't redeclare the properties, there's no storage and so the properties always return nil.

If I redeclare the storage, to use my own storage ivars via @synthesize, the properties have to be nonatomic, but the original properties don't define this, so the compiler complains that the redeclared properties do not match the originals.

What's the right way to do this, so that I can cleanly inherit the properties without complaint, but back them with whatever storage implementation I wish?

--Graham



_______________________________________________

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: Subclassing NSControl and inheritance of target, action properties
      • From: Roland King <email@hidden>
  • Prev by Date: Re: drawRect runs twice, bounds are changed in between
  • Next by Date: Re: Subclassing NSControl and inheritance of target, action properties
  • Previous by thread: Re: Allow tap events outside a custom UIPresentationController on iPad(iOS 8)
  • Next by thread: Re: Subclassing NSControl and inheritance of target, action properties
  • Index(es):
    • Date
    • Thread