Re: NSCollectionView subclassing
Re: NSCollectionView subclassing
- Subject: Re: NSCollectionView subclassing
- From: Ron Lue-Sang <email@hidden>
- Date: Fri, 9 Nov 2007 10:07:29 -0800
On Nov 9, 2007, at 9:01 AM, email@hidden wrote:
Date: Fri, 9 Nov 2007 16:33:38 +0100
From: email@hidden
Subject: NSCollectionView subclassing
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Hi list,
I am trying to subclass NSCollectionView using -
(NSCollectionViewItem *)newItemForRepresentedObject:(id)object.
The doc says in this method we have to set the view, representedObject
and layoutView for the new item. I assume layoutView is the leopard-
seeds name for collectionView. But I still don't understand how to set
it in NSCollectionViewItem because there is no setCollectionView
method. I also did [self setItemPrototype:newItem] and I get an
infinite loop.
Thanks.
As the name implies, the collectionView maintains a collection of
views. The views come from the collectionViewItems (one to one). Each
collectionViewItem has a view associated with it.
If you let the default machinery run, for every model object you feed
the collection view (its content), you'll get a copy of the
itemPrototype., including an "copy" of the collectionViewItem's view.
Your newItemForRepresentedObject should do something like
NSCollectionViewItem *item = [[NSCollectionViewItem alloc] init];
[item setRepresentedObject:passedInRepresentedObject];
[item setView:someNewViewThatWillDisplayDataFromTheRepresentedObject];
return item;
File a documentation bug, there's nothing in collectionView or
collectionViewItem that is named layoutView.
-----------------------------
Ronzilla
Core Bindings/Cocoa Builder/Interface Data
_______________________________________________
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