• 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
IB plug-in binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IB plug-in binding


  • Subject: IB plug-in binding
  • From: Livio Isaia <email@hidden>
  • Date: Wed, 26 Oct 2011 15:35:07 +0200

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).

In source code of the class myclass.h:

@interface AnotherClass : NSView {
	NSNumber *type;
}

-(NSNumber *)type;
-(void)setType:(NSNumber *)value;
@end

@interface MyClass  : NSView{
	AnotherClass *anotherClass;
...
}

-(NSNumber *)type;
-(void)setType:(NSNumber *)value;
...
@end

In source code of the class myclass.m:

@implementation AnotherClass

-(NSNumber *)type {return type;}
-(void)setType:(NSNumber *)value  {type = value;}

@end

@implementation MyClass

+ (void)initialize
{
    if (self == [MyClass class])
    {
        [NSObject exposeBinding:@"type"];
    }
}

-(NSNumber *)type {
	return [anotherClass type];
}

-(void)setType:(NSNumber *)value {
	[anotherClass setType:value];
	[self setNeedsDisplay:true];
}:


-(void)setSelectedIndex:(NSNumber *)value {
	...//get the right inner class: anotherClass = ...;
	[self setValue:[anotherClass type] forKey:@"type"];
	[self setNeedsDisplay:true];
}
@end

And in MyNSImageView.h:

@interface MyNSImageView : NSImageView {
	NSNumber *type;
}
-(NSNumber *)type {return type;}
-(void)setType:(NSNumber *)value {type = value;}
@end

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?

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

  • Prev by Date: Query core data store based on a transient calculated value
  • Next by Date: Re: Query core data store based on a transient calculated value
  • Previous by thread: Re: Query core data store based on a transient calculated value
  • Next by thread: what has happened to cocoa list?
  • Index(es):
    • Date
    • Thread