Custom NSView binding
Custom NSView binding
- Subject: Custom NSView binding
- From: Livio Isaia <email@hidden>
- Date: Tue, 01 Nov 2011 19:54:20 +0100
I repost this mail because I had problems connecting with mailing lists, sorry if this is someway annoying...
I created an IB plug-in with a subclass of NSView with an exposed bind of type NSNumber, and then I bind it to a MyNSImageView through an NSObjectController (this is made directly in IB).
Now, everything works fine, except that when the method setSelectedIndex: from MyClass is called the bound NSImageView doesn't receive any change notification.
Can anyone tell me why?
In source code of the class myclass.h:
@interface MyClass : NSView{
NSNumber *type;
}
-(NSNumber *)type;
-(void)setType:(NSNumber *)value;
...
@end
In source code of the class myclass.m:
@implementation MyClass
+ (void)initialize
{
if (self == [MyClass class])
{
[NSObject exposeBinding:@"type"];
}
}
-(NSNumber *)type {
return type;
}
-(void)setType:(NSNumber *)value {
type = value;
}:
-(void)setSelectedIndex:(NSNumber *)value {
...
[self setValue:type forKey:@"type"];
}
@end
And in MyNSImageView.h:
@interface MyNSImageView : NSImageView {
NSNumber *type;
}
-(NSNumber *)type {return type;}
-(void)setType:(NSNumber *)value {type = value;}
@end
Thank you all in advance.
Best regards,
livio. _______________________________________________
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