3
votes

I'm desperately trying to connect controls of NSViews which will reside in a NSCollectionView using outlets. The collection view is fed using an NSArrayController.

I created the NSView in a separate NIB file and in the implementation of NSCollectionViewItem I overwrote copyWithZone to load it:

    -(id)copyWithZone:(NSZone *)zone
{
    id result = [super copyWithZone:zone];

    [NSBundle loadNibNamed:@"InputView" owner:result];

    return result;
}

I've used this approach according to this instructions.

Unfortunately this is what happening:

alt text

The NSView looks like this:

alt text

The NSCollectionView resides in a NSScrollView and the scrollbar is set to enable automatically. But as you can see there's no scrollbar.

I don't really understand what I need to do so the NSCollectionView knows the dimensions of its NSViews.

It has worked before when I didn't have a seperate NIB-file, but then I couldn't make outlet connections from the view to the item :-(

1
The instructions link is broken.febeling
Well, it's a pretty old post. I wrote something about it over here that might help you though: andrehoffmann.wordpress.com/2009/08/29/…André Hoffmann

1 Answers

5
votes

How many item are in the array controller? Your output looks correct for what you've described, assuming there are at least 14 things in the controller (1 view per item). The sizing is just off. It's not clear which problem you're trying to solve.

Perhaps you were looking for a grid, and so need to call setMaximumNumberOfColumns:? Or perhaps your views aren't being resized as you expect (check -maxItemSize and -minItemSize)?