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

Re: Subclassing NSControl and inheritance of target, action properties


  • Subject: Re: Subclassing NSControl and inheritance of target, action properties
  • From: Roland King <email@hidden>
  • Date: Fri, 30 Jan 2015 08:40:43 +0800

> On 30 Jan 2015, at 08:26, Graham Cox <email@hidden> wrote:
>
>
>> On 30 Jan 2015, at 11:12 am, Roland King <email@hidden> wrote:
>>
>> I don't see this in a quick test I just typed into Xcode. I did this in the .h file
>>
>> @interface RKControl : NSControl
>> @property SEL	action;
>> @property (weak) id	target;
>> @end
>>
>>
>> and .m
>>
>> #import "RKControl.h"
>> @implementation RKControl
>> {
>> 	SEL		myAction;
>> 	id		__weak myTarget;
>> }
>>
>> @synthesize action=myAction;
>> @synthesize target=myTarget;
>> @end
>>
>> and I get no warnings or errors and the properties I believe match the originals. I dropped one on a project as an NSView, set the class, connected up a random target/action and debugged viewDidLoad to check the control was there and had a correct target/action.
>>
>> What are you seeing which is different? If you are having a problem then does it work if you don't use synthesize and go back to the good old -(thing)value, -(void)setValue:(thing)value?
>
>
> Hmmm, that's odd. My code is nearly identical, but for each property I get this warning ("semantic issue"):
>
>
> 'atomic' attribute on property 'action' does not match the property inherited from 'NSControl'
> 'atomic' attribute on property 'target' does not match the property inherited from 'NSControl'
>
> The only difference I see is that I'm declaring my ivars as part of the @interface, not the @implementation - is that a new thing? I didn't know you could do that (though it makes sense).
>
> --Graham
>

I can get that warning too, but only if I explicitly declare the property 'nonatomic', like this

@property (readwrite, nonatomic ) SEL	action; // 'atomic' attribute on property 'action' does not match the property inherited from 'NSControl'

if I declare them specifically atomic (which I thought was the default) then it stops whining. Error message could be more accurate as in 'nonatomic' attribute on ... etc.

_______________________________________________

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: Graham Cox <email@hidden>
References: 
 >Subclassing NSControl and inheritance of target, action properties (From: Graham Cox <email@hidden>)
 >Re: Subclassing NSControl and inheritance of target, action properties (From: Roland King <email@hidden>)
 >Re: Subclassing NSControl and inheritance of target, action properties (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Subclassing NSControl and inheritance of target, action properties
  • Next by Date: Re: Subclassing NSControl and inheritance of target, action properties
  • Previous by thread: Re: Subclassing NSControl and inheritance of target, action properties
  • Next by thread: Re: Subclassing NSControl and inheritance of target, action properties
  • Index(es):
    • Date
    • Thread