Re: bind imageView data to NSArrayController objectAtIndex:
Re: bind imageView data to NSArrayController objectAtIndex:
- Subject: Re: bind imageView data to NSArrayController objectAtIndex:
- From: "ad veloper" <email@hidden>
- Date: Tue, 14 Aug 2007 19:55:46 +0100
> >
> It's not clear from this why you need objectAtIndex:?
> Why is using the selection not sufficient?
>
Because it's the imageView that provides the selectionIndex and
myImageViews are not stored as an array that is managed by a
nsarraycontroller (though I can see now that it might be a good idea,
as I could observe it's @selection)
> This leaks the image (unless you're releasing it after the next line).
>
> > NSImageView *imageView = [imageViewArray objectAtIndex:index]
> > [imageView setImage:image];
> >
Sorry, incomplete snippet.
> 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?
2 core data entities with a 1->many relationship
the first say: Company is managed by an nsarraycontroller whose
arrangedObjects.name populate a popupmenu, playing with this menu sets
the selectionIndex of the company arrayController (the one we are
looking at). The Employees's arrayController's contentSet is bound to
companyController.selection
Employee's have an attribute called imageAsData, which at the moment
is a binary (NSData) attribute, this attribute is being used to
populate the imageViews.
So, drag and dropping on the imageView's populates, or replaces the
imageAsData attribute for that employee. A change in the company and
the imageViews reflect the new relationship and so on.
Does that make sense?
_______________________________________________
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