Questions tagged [nscollectionviewitem]
101 questions
1
vote
1 answer
NSCollectionView with Dynamic Width Items Using Auto Layout
I'm building an NSCollectionView that scrolls horizontally with items that look something like this:
I have my NSCollectionView item defined in a .xib with auto layout constraints. The width of the item is defined by the width of the label plus the…

Clifton Labrum
- 13,053
- 9
- 65
- 128
1
vote
0 answers
Swift: NSCollectionViewItem properties not change
I am building a Cocoa Swift app which have NSCollectionViews and have an NSCollectionView which has custom NSCollectionViewItem which has like below as in photo.
My purpose is building something like a calendar and as you understand from the image,…

eemrah
- 1,603
- 3
- 19
- 37
1
vote
0 answers
NSTableView Drag & Drop not working inside of an NSCollectionViewItem
I have a NSCollectionView and inside of the NSCollectionViewItems there is a label and a NSTableView. The NSTableViews are working properly EXCEPT for the drag & drop methods (tableView:writeRowsWithIndexes:toPasteboard:,…

3dman
- 11
- 1
1
vote
0 answers
NSCollectionView as NSCollectionViewItem
Here is the window I want to achieve:
It is a NSViewController (RedViewController) with NSCollectionView (RedCollectionView) as view.
It item (BlueItem) has a NSCollectionView (BlueCollectionView) as view.
It item's item (GreenItem), has a…

nouatzi
- 735
- 4
- 14
1
vote
0 answers
How do you access an outlet in a collectionitem?
I have an NSCollectionView which is populated by collection items. An array controller is used to add the items to the view. Each item has two outlets, an imageview and textview (not field), that the user can edit themselves. How would you gain…

Rupertina
- 11
- 1
1
vote
1 answer
invalidationContext(forPreferredLayoutAttributes:withOriginalAttributes:) isn't called on a custom NSCollectionViewLayout subclass
Link to the relevant sample project
Description
I’m trying to create a custom NSCollectionViewLayout subclass that uses use Auto Layout to determine its items’ sizes. This layout positions items from top-to-bottom, where all items share the same…

sbrun
- 197
- 2
- 13
1
vote
1 answer
Cant get NSCollectionView NSCollectionViewItem to work
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
let item = NSNib(nibNamed: NSNib.Name("CollectionViewItem"), bundle: nil)
self.collectionView.register(item, forItemWithIdentifier:…

spacecash21
- 1,331
- 1
- 19
- 41
1
vote
0 answers
backgroundColor change not visible
In my NSCollectionViewItem I set up a mouseDown function, that calls a setSelected() function in the view.
override func mouseDown(with event: NSEvent) {
(self.view as! ListTableViewCell).setHighlighted(true, animated: true, completionHandler:{
…

user4992124
- 1,574
- 1
- 17
- 35
1
vote
1 answer
Cannot drag onto image in NSCollectionViewItem
I am designing a folder browser application similar to Finder. I want to enable users to drag files from outside the application and drop them onto a folder within my application, causing the dragged items to be added into that folder.
My custom…

casvaart
- 555
- 1
- 5
- 14
1
vote
1 answer
How to drag items from NSCollectionView
I'm trying to implement dragging items from an NSCollectionView (not just dropping things on it).
In my example code, I'm registering the CollectionView from…

Vogel Vogel
- 311
- 1
- 4
- 12
1
vote
1 answer
Passing values from custom NSView to NSCollectionViewItem
I have an NSTabView inside my custom NSView that is used as the prototype for the NSCollectionView. In the second tab I have NSButton button and NSImageView objects.
NSButton is a "Browse" button that triggers the NSOpenPanel.
I have connected the…

anna
- 2,723
- 4
- 28
- 37
1
vote
1 answer
Drag selecting in NSCollectionView from inside of items
I have a series of items that I am showing them in a NSCollectionView. The selection and multiple selection are both enabled.
The user can select items by dragging (i.e. marking items by drag). however this works when the user start dragging from…
user7649191
1
vote
1 answer
NSCollectionView renders all NSCollectionViewItems at the same point
I am trying to create a simple NSCollectionView programmatically. I am setting it up in the NSViewController:
class ViewController: NSViewController {
var scrollView: NSScrollView!
var collectionView: NSCollectionView!
override func…

Sam Fischer
- 1,442
- 19
- 35
1
vote
1 answer
NSCollectionView doesn't seem to need registering its item class
When I made NSCollectionView UI...
First time, I registered my collection view item class using
self.cv.register(NSNib.init(nibNamed: "ContentItemOneClass", bundle: nil), forItemWithIdentifier: "ContentItemOneClass")
and I added more collection…

WoffOVkee
- 435
- 3
- 16
1
vote
2 answers
NSCollectionView is drawing NSCollectionViewItems over each other
My NSCollectionView is drawing my NSCollection items over each other.
UPDATE: I have added a sample project
GitHub Sample Project
UPDATE: This has changed somewhat
When the app first launches it looks like this
UPDATE
My current example has two…

Tempus
- 13
- 5