Questions tagged [nscollectionviewitem]

101 questions
3
votes
1 answer

Centered items in NSCollectionView

I'm developing a simple gallery for an application for OS X, by default, the items of a NSCollectionView are in left, How I get its items centered in its width? like this image:
2
votes
2 answers

Custom outlets in NSCollectionViewItem subclass

I feel this being a simple task, but I don't seem to be able to make it work. I'm trying to have a NSCollectionView with custom items. I added another NSImageView to the custom view of the item, and I subclassed this view in order to add the custom…
Donovan
  • 6,002
  • 5
  • 41
  • 55
2
votes
2 answers

How do you initialize a NSCollectionViewItem?

I am trying to setup an NSCollectionView that has custom drawing in the individual NSCollectionViewItem views. I have an image that I need to draw in each view, but I cannot link the view back to the NSCollectionViewItem subclass in Interface…
David
  • 1,674
  • 1
  • 21
  • 35
2
votes
1 answer

NSCollectionView cell order changes on view change

I have a macOS application that contains a tab bar design (ie: Tweetbot). There are 4 tabs that are linked to 4 different view controllers. The initial view controller (view one) contains a NSCollectionView which displays 3 cells horizontally. This…
2
votes
2 answers

Dynamic Size for NSCollectionViewItem

I am trying to give a dynamic size to my NSCollectionViewItem. I want them to have a size determine by their content and the constraint I defined. For that I have add to my viewcontroller which holds the NSCollectionView the following : extension…
user6241056
2
votes
1 answer

NSCollectionViewItem messed after reloadData

Im working with NSCollectionView and NSCollectionViewItems. I have met following problem: If I rotate an NSImageView of one of the items, and then call reloadData, updated view would be messed up. Rotation would jump to the next item, angle would…
PolosatiyVjih
  • 269
  • 3
  • 12
2
votes
1 answer

Auto resize NSCollectionViewItem to fit screen

I'm trying to create a NSCollectionView where it's items adapt to the available space rather than defining a fixed size for the items and resize the NSCollectionView accordingly. I couldn't figure out a way to achieve that with the…
rooney
  • 45
  • 5
2
votes
0 answers

How to mimic the item highlight behavior of NSTableView in NSCollectionView?

I have NSCollectionView with custom items which contain NSTextField and NSImageView. I realized highlight behavior of collection view items manually (ie. redefined the setSelected: method in my NSCollectionViewItem descendant class). I successfully…
2
votes
3 answers

deselect NSCollectionViewItem by clicking on it

How can I deselect a NSCollectionViewItem by clicking on it again? This is the code I use for selecting and deselecting: func collectionView(collectionView: NSCollectionView, didSelectItemsAtIndexPaths indexPaths: Set) { …
sanjihan
  • 5,592
  • 11
  • 54
  • 119
2
votes
0 answers

layer cannot be modified in NSCollectionViewItem

I subclassed an NSCollectionViewItem and want to modify the layer of its view, but I can't get it to work. override func awakeFromNib() { self.view.layerContentsRedrawPolicy = NSViewLayerContentsRedrawPolicy.OnSetNeedsDisplay …
Christian
  • 129
  • 9
2
votes
1 answer

Changing the selection behaviour of NSCollectionView

In my Mac app I have a NSCollectionView with multi select enabled. In my app being able to select more than one item is the norm, and having to press cmd while clicking to select multiple items is frustrating some users and most don't realise they…
Richard Garside
  • 87,839
  • 11
  • 80
  • 93
2
votes
1 answer

Resize view of NSCollectionViewItem

How do I programatically set the size of a view of an NSCollectionViewItem? I tried doing this in an NSCollectionView subclass: @implementation CustomCollectionView - (NSCollectionViewItem *)newItemForRepresentedObject:(id)object { …
indragie
  • 18,002
  • 16
  • 95
  • 164
2
votes
1 answer

Bindings for custom views for NSCollectionViewItem

I've got a NSCollectionView bound to my array of model objects, the NSView prototype to render items of the collection view is set up to use my custom NSView subclass. At runtime a (generic) view is shown/instantiated in the collection view for each…
Jay
  • 6,572
  • 3
  • 37
  • 65
2
votes
0 answers

CALayer in NSCollectionViewItem flashes (and disappears) whenever a new item is added in the collection

My NSCollectionViewItem is in a separate xib file. It has an image view. Previously I was setting image directly on the NSImageView. The UI worked fine. Now, I have added a CALayer to NSImageView. I use it to display images and transition from from…
Andrew-Dufresne
  • 5,464
  • 7
  • 46
  • 68
1
vote
1 answer

NSCollectionViewItem and support for accessibility

I'm using a NSCollectionView to layout custom views horizontally. Each NSCollectionViewItem hosts a custom NSView that acts like a checkbox. These custom child views support accessibility on their own (by overriding the required accessibility…