NSCollectionView Subclass difficulties
NSCollectionView Subclass difficulties
- Subject: NSCollectionView Subclass difficulties
- From: Jaime Magiera <email@hidden>
- Date: Sun, 10 Feb 2008 22:31:23 -0500
Hello,
I'm trying to wrap my brain around NSCollectionView. I have experience
with WebObjects collections, but that's about it.
I've subclassed NSCollectionView and overridden -
(NSCollectionViewItem *)newItemForRepresentedObject:(id)object to
provide unique views depending on a particular key of the
representedObject. So far, so good - when adding one item. However, if
I add two items (using the example below, of type "video"), the first
item moves down in the collection display, but a new item does not
appear. There's just a blank space there. It's likely something small
that I just haven't picked up on. Any help appreciated. Thanks.
Here is the general setup...
@interface MyCollectionView : NSCollectionView {
IBOutlet NSCollectionViewItem* videoViewItem; // bound to a NIB
object of NSCollectionViewItem, which is bound to a unique view
IBOutlet NSCollectionViewItem* genericViewItem; // bound to a NIB
object of NSCollectionViewItem, which is bound to a unique view
}
@implementation MyCollectionView
- (NSCollectionViewItem *)newItemForRepresentedObject:(id)object
{
if([[[object header] objectForKey:@"type"] isEqualToString:@"Video"])
{
[videoPrototype setRepresentedObject:object];
return videoPrototype;
} else {
[genericPrototype setRepresentedObject:object];
return genericPrototype;
}
}
thanks for any thoughts,
Jaime Magiera
Sensory Research
http://www.sensoryresearch.net
_______________________________________________
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