• 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
Custom NSView binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Custom NSView binding
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Problems with runModalForWindow, looking for alternatives
  • Next by Date: Re: Sandboxing question
  • Previous by thread: Re: Write to file Entitlement
  • Next by thread: Re: Custom NSView binding
  • Index(es):
    • Date
    • Thread