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: Roland King <email@hidden>
- Date: Fri, 30 Jan 2015 08:12:36 +0800
> On 30 Jan 2015, at 07:44, Graham Cox <email@hidden> wrote:
>
> NSControl has properties target, action.
>
>
> 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.
>
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?
_______________________________________________
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