• 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
NSCollectionView Subclass difficulties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSCollectionView Subclass difficulties
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: self = [super init] debate.
  • Next by Date: Re: self = [super init] debate.
  • Previous by thread: -[NSFileHandle waitForDataInBackgroundAndNotify] versus CFFileDescriptor
  • Next by thread: Re: NSCollectionView Subclass difficulties
  • Index(es):
    • Date
    • Thread