Bindings with a custom view
Bindings with a custom view
- Subject: Bindings with a custom view
- From: Steve Israelson <email@hidden>
- Date: Wed, 27 Jun 2007 15:27:04 -0700
I have made a custom view that can show a list of items in a grid
like view.
I also have a view of the same list in a table.
I have an NSArrayController bound to both views.
When I make a selection in the NSTableView, I correctly see that same
selection in my grid like view.
When I make a selection in my custom view, the NSTableView does NOT
mirror the selection.
It seems like the binding for the selected indexes is not working for
my custom view.
I can't see why though.
I looked at the KVC docs on ensuring compliance and I think I am
compliant.
Is there anything I am missing?
The relevant code is:
@interface PhotoGridView : NSView
{
NSIndexSet *selectedPhotoIndexes;
}
- (NSIndexSet *)selectedPhotoIndexes;
- (void)setSelectedPhotoIndexes:(NSIndexSet *)inSet;
@end
@implementation PhotoGridView
+ (void)initialize;
{
[self exposeBinding:@"selectedPhotoIndexes"];
}
- (NSIndexSet *)selectedPhotoIndexes;
{
return selectedPhotoIndexes;
}
- (void)setSelectedPhotoIndexes:(NSIndexSet *)inSet;
{
[selectedPhotoIndexes release];
selectedPhotoIndexes = [inSet copy];
[self setNeedsDisplay:YES];
}
@end
_______________________________________________
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