Is there a way to have varying views in an NSCollectionView?
I am wanting something similar to how iWork has the template selection screen for Pages when you can select different templates, and each view contains different info has difference sizes etc.

I have tried subclassing NSCollectionView and determining which view to display using the newItemForRepresentedObject method (as opposed to using itemPrototype view Interface Builder), but it for some reason doesn't position the views correctly, and it does not show the correct number of views for the number of items present. Here is my code. I was hoping someone may have a better way to do this, or an example of how this is done.

personView and companyView are properties in the subclassed NSCollectionView, that are IBOutlets to views in IB.

    -(NSCollectionViewItem *)newItemForRepresentedObject:(id)object{
	NSCollectionViewItem *collectionViewItem = [[NSCollectionViewItem alloc] init];
	 
	 [collectionViewItem setRepresentedObject:object];
	 
	 if([[object valueForKey:@"company"] boolValue] == YES){
		 NSView *view = [companyView retain];
		 [collectionViewItem setView:companyView];
	 }else{
		 [collectionViewItem setView:personalView];
	 }
	  
	return collectionViewItem;
}


Is there a way to have varying views in an NSCollectionView?
===

I am wanting something similar to how iWork has the template selection screen for Pages when you can select different templates, and each view contains different info has difference sizes etc.

I have tried subclassing NSCollectionView and determining which view to display using the newItemForRepresentedObject method (as opposed to using itemPrototype view Interface Builder), but it for some reason doesn't position the views correctly, and it does not show the correct number of views for the number of items present. Here is my code. I was hoping someone may have a better way to do this, or an example of how this is done.

personView and companyView are properties in the subclassed NSCollectionView, that are IBOutlets to views in IB.

    -(NSCollectionViewItem *)newItemForRepresentedObject:(id)object{
	NSCollectionViewItem *collectionViewItem = [[NSCollectionViewItem alloc] init];
	 
	 [collectionViewItem setRepresentedObject:object];
	 
	 if([[object valueForKey:@"company"] boolValue] == YES){
		 NSView *view = [companyView retain];
		 [collectionViewItem setView:companyView];
	 }else{
		 [collectionViewItem setView:personalView];
	 }
	  
	return collectionViewItem;
}

