Search code examples
objective-cxcodecocoanscollectionviewnscollectionviewitem

Cocoa - How to change the size of NSCollectionViewItem and layout programmatically?


I want to change the layout of the NSCollectionView programmatically with 3 buttons, each button will change the layout of the collection view - 2, 3, 4 columns per row. And the NSCollectionViewItem size has to be auto-resized.

I tried searching all day, but found nothing helpful. Any help would be appreciated.

Thanks


Solution

  • I couldn't satisfy with Apple's stock NSCollectionView. Fortunately, Jonathan made a nice custom collection view called JNWCollectionView for cocoa which has very similar mechanics with UICollectionView on iOS.