Re: Troubles with CollectionView and IKImageBrowserView
On Jun 12, 2008, at 00:25, Jens Alfke wrote: On 11 Jun '08, at 1:14 PM, Manuel wrote: But the IKImageBrowserView doesn't call these methods. I setup a testmethod in the MYNSCollectionViewItem like the following code, to verify that the imagebrowser outlet is set and to set again the datasource: Hm, I don't have any exact ideas, but I wonder if something's going wrong because CollectionViewItems get copied. (The one you wire up in the nib is a prototype, and the view makes a copy of it for every item it needs.) Perhaps the item is getting set as the image- browser's data source before the copy, so the instance being displayed isn't actually the one that's the data source? Jens is right in that copying the collection view is often a problem, as NSView does not support the NSCopying protocol. There's some more information on the way that NSCollectionView copies the view here:http://www.cocoadev.com/index.pl?NSCollectionView (near the bottom). I got it working like this: - put your custom view initialisation in initWithCoder: (as that is the one used to copy the original instance / unarchive your nib) - in your view, have an IBOutlet that's connected to the NSCollectionViewItem instance (called cvItem in my case) - in awakeFromNib bind the properties you're interested in (as these get restored / set correctly in the cloning process), e.g. - (void)awakeFromNib { [self bind:@plotRoot toObject:cvItem withKeyPath:@representedObject options:nil]; [self bind:@isSelected toObject:cvItem withKeyPath:@selected options:nil]; } This setup works fine for me (ignoring the other known bugs and documentation deficiencies of NSCollectionView — it's slightly disheartening when you file a bug on it, get a dup back and realise it's been known long enough for 1094954 other bugs to be filled..). HTH, Daniel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Troubles with CollectionView and IKImageBrowserView
Hello Macprogrammers I've a problem with my IKImageBrowser in combination with a CollectionViewItem. I have a NSWindow with a NSCollectionView and a NSArrayController. I extended the NSCollectionViewItem to reference the IKImageBrowserView in an outlet and use the NSCollectionViewItem as a Datasource for the IKImageBrowser (Connected together in Interface Builder): NSWindows - NSCollectionView (With NSArrayController) - MYNSCollectionViewItem (as ControllerItem) - NSViewItem - IKImageBrowserView In MyNSCollectionViewItem I've implemented following 2 Datasource Methods: - (int)numberOfItemsInImageBrowser:(IKImageBrowserView*)view - (id)imageBrowser:(IKImageBrowserView *) view itemAtIndex:(int) index But the IKImageBrowserView doesn't call these methods. I setup a testmethod in the MYNSCollectionViewItem like the following code, to verify that the imagebrowser outlet is set and to set again the datasource: - (IBAction)refreshView:(id)sender { Album *representedObject = [self representedObject]; NSLog(@UniqueData per row: %@, [representedObject uniqueData]); [imageBrowser setDataSource:self]; [imageBrowser reloadData]; } But even if i explicit set the IKImageBrowser DataSource to the MYNSCollectionViewItem the DataSource methods wouldn't be called by the IKImageViewBrowser. Do you know this problem? Outside the new CollectionView with a simple implementation, this code works very well. Kind regards from Lucerne (Switzerland) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Troubles with CollectionView and IKImageBrowserView
On 11 Jun '08, at 1:14 PM, Manuel wrote: But the IKImageBrowserView doesn't call these methods. I setup a testmethod in the MYNSCollectionViewItem like the following code, to verify that the imagebrowser outlet is set and to set again the datasource: Hm, I don't have any exact ideas, but I wonder if something's going wrong because CollectionViewItems get copied. (The one you wire up in the nib is a prototype, and the view makes a copy of it for every item it needs.) Perhaps the item is getting set as the image-browser's data source before the copy, so the instance being displayed isn't actually the one that's the data source? —Jens smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]