I need to programatically resize the view of an NSCollectionViewItem as soon as it is created. So far I tried this (subclassing NSCollectionView and overriding newItemForRepresentedObject)

@implementation IGCollectionView

- (NSCollectionViewItem *)newItemForRepresentedObject:(id)object {
        
    NSCollectionViewItem *newItem = [[self itemPrototype] copy];
    [newItem setRepresentedObject:object];      
    NSView *itemView = [newItem view];
[itemView setFrame:NSMakeRect([itemView frame].origin.x, [itemView frame].origin.y, [itemView frame].size.width, 500)];
    return newItem;
}

@end

Nothing happens. I also put this in the awakeFromNib method of my main app controller:

[collectionView setMaxItemSize:NSMakeSize(999, 999)];

To make sure that it wasnt being restricted by the max size. Is there a better way to do this?

_______________________________________________

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 arch...@mail-archive.com

Reply via email to