How to use NSCollectionView and Outlets correctly?

I am desperately trying to hook up NSViews controls that will be in NSCollectionView using outlets. The collection view is served using the NSArrayController.

I created 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 used this approach as instructed.

Unfortunately, this is what happens:

alt text

NSView is as follows:

alt text

NSCollectionView is located in NSScrollView, and the scroll bar is set to turn on automatically. But, as you can see, there is no scroll bar.

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

, NIB , : - (

+3
1

? , , , 14 (1 ). . , .

, , setMaximumNumberOfColumns:? , , , ( -maxItemSize -minItemSize)?

+5

Source: https://habr.com/ru/post/1714217/


All Articles