Questions tagged [nscollectionview]

NSCollectionView is a NSView subclass which provides basic functionality for displaying, arranging, grouping and manipulating graphical representations of collections of objects.

NSCollectionView is a NSView () subclass which provides basic functionality for displaying, arranging, grouping and manipulating graphical representations of collections of objects.

Xcode 7 introduced a new API for NSCollectionView so that it can be implemented similarly to the iOS counterpart (UICollectionView). In OS X 10.11+ you can access NSCollectionView using its datasource and delegate protocols.

428 questions
9
votes
3 answers

Is there a way to set up a NSCollectionView programmatically in Swift?

I'm coming from the iOS development and I am wondering if there is a way to set up a NSCollectionView programmatically like a UICollectionView in iOS? And add the NSCollectionViewItems in code. Or is the only way to set up a NSCollectionView to use…
stefOCDP
  • 803
  • 2
  • 12
  • 20
9
votes
8 answers

Can NSCollectionView autoresize the width of its subviews to display one column

I have an NSCollectionView that contains a collection of CustomViews. Initially it tiled the subviews into columns and rows like a grid. I then set the Columns property in IB to 1, so now it just displays them one after another in rows. However,…
littlecharva
  • 4,224
  • 8
  • 45
  • 52
8
votes
5 answers

Get index of a view inside a NSCollectionView?

I've developed an app for Mac OS X Lion using its new view-based NSTableView, but as I want to port the whole app to Snow Leopard I'm trying to figure out the best way to emulate such a tableview. So far I've created a NSCollectionView and…
Nickkk
  • 2,261
  • 1
  • 25
  • 34
8
votes
1 answer

Using NSCollectionView without bindings

Is there a way to use an NSCollectionView without bindings?
8
votes
3 answers

Full width NSCollectionViewFlowLayout with NSCollectionView

I have a NSCollectionViewFlowLayout which contains the following: - (NSSize) itemSize { return CGSizeMake(self.collectionView.bounds.size.width, kItemHeight); } // End of itemSize - (CGFloat) minimumLineSpacing { return 0; } // End of…
Kyle
  • 17,317
  • 32
  • 140
  • 246
8
votes
5 answers

How to implement contextual menu for NSCollectionView

In my OSX app I have a collection view which is a subclass of NSCollectionView. I'm all satisfied with how the things are except the contextual menu, which I can't figure out yet. So what I want is: right-click on a collection view item brings up…
Eugene Gordin
  • 4,047
  • 3
  • 47
  • 80
8
votes
3 answers

Double Click in NSCollectionView

I'm trying to get my program to recognize a double click with an NSCollectionView. I've tried following this guide: http://www.springenwerk.com/2009/12/double-click-and-nscollectionview.html but when I do it, nothing happens because the delegate in…
user1998511
  • 455
  • 1
  • 8
  • 21
7
votes
2 answers

NSCollectionView memory leak in High Sierra?

I have noticed a memory leak in NSCollectionView through Instruments. When I track down to the code, it shows the specific line below: collectionView.makeItem(withIdentifier: identifier, for: indexPath) as? DisplayableCellProtocol Then I looked it…
WatashiJ
  • 722
  • 6
  • 19
7
votes
1 answer

NSCollectionView draws nothing

I'm trying to set up an NSCollectionView (I have done this successfully in the past, but for some reason it fails this time). I have a model class called "TestModel", and it has an NSString property that just returns a string (just for testing…
6
votes
1 answer

View-based NSTableView vs NSCollectionView?

I've understood the fly-weight approach of cell-based NSTableView and I think I understand the differences with NSCollectionView.Differences between (cell-based) NSTableView and NSCollectionView However, a bit less obvious is the differences between…
user1040049
6
votes
2 answers

NSCollectionView Drag and Dropping: Most Delegate Events Not Getting Called

I have an NSCollectionView bound to an NSArrayController. I want to get drag and drop working, so I create a delegate and implement the methods -(BOOL)collectionView:(NSCollectionView *)collectionView canDragItemsAtIndexes:(NSIndexSet *)indexes…
James Williams
  • 1,861
  • 1
  • 15
  • 21
6
votes
5 answers

NSCollectionView custom layout enable scrolling

I can't get scrolling both vertically and horizontally to work with a custom layout for NSCollectionView. According to the docs, in my subclass I return the collectionViewContentSize and if that is too big, scrolling is automatically enabled in the…
DasNilpferd
  • 61
  • 1
  • 3
6
votes
2 answers

How to give Space between rows and columns of NSCollectionView?

I have created collection view and I am unable to give space between the collection view items. So please help.... Thanks in advance... I have used this link to create collection view…
Amit Khandelwal
  • 175
  • 1
  • 11
6
votes
1 answer

Is there a way to have varying views in an NSCollectionView?

I am wanting something similar to how iWork has the template selection screen for Pages when you can select different templates, and each view contains different info has difference sizes etc. I have tried subclassing NSCollectionView and…
Patrick
  • 1,079
  • 1
  • 9
  • 14
6
votes
2 answers

NSCollectionViewItem double-click action?

How do I set an action for when a user double clicks an NSCollectionViewItem. NSTableView, for example, has the setDoubleAction method. Is there something similar for NSCollectionView? Thanks
indragie
  • 18,002
  • 16
  • 95
  • 164
1
2
3
28 29