Connecting a custom control to manipulate NSArrayController's selection.
Connecting a custom control to manipulate NSArrayController's selection.
- Subject: Connecting a custom control to manipulate NSArrayController's selection.
- From: Scott Andrew <email@hidden>
- Date: Sun, 25 Mar 2007 17:57:00 -0700
I am using MUPhotoView for displaying a list of pictures. However i
have a bunch of my controls that update based on the selection of the
photo by connecting to the NSArrayContoller's "selection" key.
I have done the following:
[photoView bind:@"selectedPhoto" toObject:imagesToExportController
withKeyPath:@"selection" options:nil];
i have then added the following:
-(NSObject*)selectedPhoto
{
return selectedPhoto;
}
-(void)setSelectedPhoto:(NSObject*)obj
{
[self willChangeValueForKey:@"selectedPhoto"];
selectedPhoto = [obj retain];
[self didChangeValueForKey:@"selectedPhoto"];
}
As my selection changes i call setSelectedPhoto. However i don't get
any updates in my other controls as my selection changes. How do i
update my array controller as my selection changes in the control and
have it post changes to the other controls? Do i need to store the
array controller and manipulate it? My total hookup looks liek the
following:
// bind the photo array controller to the control.
[photoView bind:@"photosArray" toObject:imagesToExportController
withKeyPath:@"arrangedObjects" options:nil];
[photoView bind:@"selectedPhotoIndexes"
toObject:imagesToExportController withKeyPath:@"selectionIndexes"
options:nil];
[photoView bind:@"selectedPhoto" toObject:imagesToExportController
withKeyPath:@"selection" options:nil];
Thank you,
Scott Andrew
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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