• 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
Re: bind imageView data to NSArrayController objectAtIndex:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: bind imageView data to NSArrayController objectAtIndex:
      • From: "ad veloper" <email@hidden>
References: 
 >bind imageView data to NSArrayController objectAtIndex: (From: "ad veloper" <email@hidden>)
 >Re: bind imageView data to NSArrayController objectAtIndex: (From: mmalc crawford <email@hidden>)
 >Re: bind imageView data to NSArrayController objectAtIndex: (From: "Cathy Shive" <email@hidden>)
 >Re: bind imageView data to NSArrayController objectAtIndex: (From: mmalc crawford <email@hidden>)
 >Re: bind imageView data to NSArrayController objectAtIndex: (From: "ad veloper" <email@hidden>)

  • Prev by Date: Re: bind imageView data to NSArrayController objectAtIndex:
  • Next by Date: Some architecture questions
  • Previous by thread: Re: bind imageView data to NSArrayController objectAtIndex:
  • Next by thread: Re: bind imageView data to NSArrayController objectAtIndex:
  • Index(es):
    • Date
    • Thread