Re: bind imageView data to NSArrayController objectAtIndex:
Re: bind imageView data to NSArrayController objectAtIndex:
- Subject: Re: bind imageView data to NSArrayController objectAtIndex:
- From: mmalc crawford <email@hidden>
- Date: Tue, 14 Aug 2007 11:34:25 -0700
On Aug 14, 2007, at 11:23 AM, ad veloper wrote:
The arrayController's contentSet is bound to another arrayController's
selection. Drag and drop into the imageCell performs this action:
- (IBAction)imageDropped:(id)sender {
(assume I have obtained the index of the sender and the
arraycontroller is ascending order sorted to match) then ..
[[[arrayController arrangedObjects] objectAtIndex:indexOfImageCell]
setValue:[image TIFFRepresentation] forKey:@"imageData"]];
}
It's not clear from this why you need objectAtIndex:?
Why is using the selection not sufficient?
I think if I implement an observer for the other arrayControllers
selectionIndexes and then populate the image cell's in the observer
method using:
NSImage *image = [[NSImage alloc] initWithData:[[[arrayController
arrangedObjects] objectAtIndex:index] valueForKey:@"imageData"]];
This leaks the image (unless you're releasing it after the next line).
NSImageView *imageView = [imageViewArray objectAtIndex:index]
[imageView setImage:image];
It's not clear exactly what are the objects managed by the array
controller.
If they're not instances of NSData, then it's not clear that observing
selectionIndexes will always do the right thing.
What are you trying to achieve?
mmalc
_______________________________________________
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