Re: Subclassing NSControl and inheritance of target, action properties
Re: Subclassing NSControl and inheritance of target, action properties
- Subject: Re: Subclassing NSControl and inheritance of target, action properties
- From: Graham Cox <email@hidden>
- Date: Fri, 30 Jan 2015 11:26:56 +1100
> 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
_______________________________________________
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