Questions tagged [nscollectionviewitem]

101 questions
1
vote
1 answer

why my NSImageView in NSCollectionViewItem'view is nil?

In IB I create a NSCollectionView and its NSCollectionViewItem and a NSView which belongs to NSCollectionViewItem.My NSCollectionItem consist of a NSImageView and a NSTextField.I set them values using cocoa bindings.I want to change the border color…
gohamgx
  • 273
  • 2
  • 16
1
vote
1 answer

Get the representedObject values of NSCollectionViewItem NSButton click

I have read some questions and I find some very confusing and I don't really know if they answer my question. I have an NSCollectionView implemented and connected to a Core Data context, everything shows correctly. Now what I have is buttons in the…
1
vote
2 answers

Resizing NSCollectionView to fit inner items?

How can I resize my NSCollectionView to fit the size of all my items ? I tried something like that : float height=0; for(int i=0;i<[drives count]; i++) { height += [[[collectionView itemAtIndex:i] view] bounds].size.height; } NSLog(@"%lg",…
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
0
votes
1 answer

nsimageview valueUrl binding is not working

i am new to cocoa programming. I am having a nsimageview and nstextfield in a nscollectionviewitem. How to update the nsimageview with external url in nscollectionview. Binding works fine for the nstextfield and not for the nsimageview. After…
user691106
  • 21
  • 4
0
votes
1 answer

on Double Click of NSCollectionViewItem open new window or view NSCollectionViewItem in same window

How to open a new window or view on double click of NSCollectionViewItem? My collectionViewItem is custom class derive from my NSBox so how to open can you please help me? And please send me some sample?
0
votes
0 answers

Value of variables in NSCollectionViewItem is incorrect or nil

I have a NSCollectionView in my NSViewController and I pass the data as follow: func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { guard let item =…
0
votes
0 answers

Collection View Item clicked when selected

For now, I have this: func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set) { print(indexPaths) } } and it works when the item was not already selected. I'm looking for some way…
0
votes
1 answer

How can I skip the first cell in a NSCollectionView?

How can NSCollectionView items begin at the second cell and leave the first cell empty? (View Example)
0
votes
1 answer

how to fix NSCollectionViewItem overlap problem?

i use NSCollectionView to display a horizontal list. but all of the cells overlap in the first cell position, like this. i don't have enough reputation to post images. [cell1,cell2,cell3], they all overlap in the first cell position. so it look like…
0
votes
1 answer

NSCollectionViewItem button action No effect

Clicking the button has no effect I hope someone with good intentions can help me see why Below is my code class cell_word_list_1: NSCollectionViewItem { static let item = NSUserInterfaceItemIdentifier(rawValue: "cell_list_id_1") override…
901
  • 5
  • 4
0
votes
1 answer

NSCollectionView memory leaks

I have an NSCollectionView specified as both my DataSource and my Delegate. I have two issues: Rather than doing the registerClass method, attempting to instead use the 3 lines of commented code with the (non-nil) protoNib means of registering with…
zzyzy
  • 973
  • 6
  • 21
0
votes
1 answer

Variables being reset in NSCollectionViewItem

I'm trying to update a NSTextField title inside of a NSCollectionViewItem from a parent NSCollectionViewDataSource. Here is my code. NSCollectionViewDataSource func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt…
0
votes
0 answers

Deleting sections and header in NSCollectionView (Sticky Header Flow Layout)

With the code posted below for a sticky header collection view layout, how would I go about deleting a section (along with the header) from the view when I've deleted the last item in a section? Not sure if there's place in the ViewController file…
JamesH
  • 67
  • 6
0
votes
0 answers

Getting error when I load NSCollectionViewItem

I am getting the following error when I tried to load NSCollectionviewItem in: collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) Error : could not instantiate an NSViewController for a nib in the …
Aabid Khan
  • 27
  • 1
  • 7
0
votes
1 answer

NSView subclass for NSCollectionViewItem's item outlet not drawing consistently

I have searched everywhere for this one but have had no luck. I am using an NSCollectionView in my project with bindings to Core Data via an Array Controller. In order to make it look the way I want I have subclassed NSView with a new drawRect…