Question

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 :-(

Was it helpful?

Solution

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)?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top