nscollectionview

NSTextView does not scroll when created with NSCollectionView

旧时模样 提交于 2019-12-08 03:30:28
问题 I have an NSTextView that is on a view that is the view of an NSCollectionViewItem. I give the user the option to hide the NSTextView and instead bring up an NSView object in its place on the same view. However, when I run the program with the NSView object hidden and overlapping the NSTextView, scrolling in the NSTextView does not work correctly; The vertical scroll bar is there and adjusts its size accordingly to the size of the content in the NSTextView. However, the actual scrolling only

How do you initialize a NSCollectionViewItem?

假装没事ソ 提交于 2019-12-07 18:55:05
问题 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 Builder. Is there an init method I can use with my NSCollectionViewItem in order to perform initialization operations? I tried to implement copyWithZone, but I was doing something wrong because I got some eternal loop. Currently, the only opportunity I

Differences between NSTableView and NSCollectionView

谁说胖子不能爱 提交于 2019-12-06 12:11:38
问题 I'm trying to decide which path to take for developing my Snow Leopard app. First, I should preface with the obvious differences: NSTableView can have multiple columns of data for representing different parts of the same "element" of data (a row) where NSCollectionView can display a grid of data as well, but every row+column combo is its own element. For my purposes, assume I'm dealing with a single column. As far as I can tell, NSCollectionView items are NSView s which all must be of the

How do you initialize a NSCollectionViewItem?

[亡魂溺海] 提交于 2019-12-06 05:49:07
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 Builder. Is there an init method I can use with my NSCollectionViewItem in order to perform initialization operations? I tried to implement copyWithZone, but I was doing something wrong because I got some eternal loop. Currently, the only opportunity I have found to make my connections to the view are after the selection has changed using -(void

Binding to NSCollectionViewItem crashes Xcode

淺唱寂寞╮ 提交于 2019-12-06 01:32:39
Using XCode 4.1 I've come across a crash whenever I try to use a CollectionView. These are the steps I'm doing: From a new project, edit the MainMenu.nib file. Add an NSCollectionView to the window, which also adds a Collection View Item, and a new View In the new View Add a control like an NSTextField Select the control, and switch the inspector to the binding pane. Attempt to bind something to the Collection View Item. Once the Collection View Item is selected in the dropdown menu, an "Internal Error" dialog appears. Attempting to continue from this dialog makes the binding pane disappear

How to Color the “Overshoot” Background of an NSCollectionView

跟風遠走 提交于 2019-12-05 23:48:57
I have implemented a collection view on my Cocoa app following Ray Wenderlich's tutorial (very helpful, given how buggy and broken Apple's API is in this area). In the tutorial, the collection view's canvas is colored black using the following code (all code is in view controller class' viewDidLoad() method): collectionView.layer?.backgroundColor = NSColor.black.cgColor However, the area that "peeks" when you overshoot ("rubber-band") the scroll using -for example- a magic mouse/scrollwheel, is still white and very distracting: I'm trying to make the whole content area black. In my storyboard,

Debugging Nested NSCollectionViews

梦想的初衷 提交于 2019-12-05 13:53:34
I'm not really sure how to start debugging this issue. I've got an NSCollectionView, whose NSCollectionViewItem prototype view itself contains an NSCollectionView (as well as an NSArrayController, to provide content to this 2nd-level collection view). Both levels of collection view work fine when the top-level view is in the main nib. However, when I copy/paste the view (and reconnect all the appropriate bindings) to a new nib, which I load with loadNibNamed:owner: , the 2nd-level view--but not the top-level one--appears blank. Upon some investigation, I discovered that myArrayController

How do I bind programatically in the view subclass of my NSCollectionView?

只谈情不闲聊 提交于 2019-12-05 02:26:04
问题 I've successfully created an NSCollectionView and added a label to the view prototype in IB, bound to a property of my represented object. I now want to programatically create an NSButton and NSTextField with the NSTextField bound to a property of my represented object. When the button is clicked I want to show and hide the NSTextField. The problem I've come across is if I put my initialization code for my controls in the view's initWithCoder method, and the binding in the view's awakeFromNib

Resizing NSCollectionView to fit inner items?

落爺英雄遲暮 提交于 2019-12-04 19:12:55
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", height); [[self view] setBoundsSize:NSMakeSize(300, height)]; and all I got was a horrible result : the collectionView was distorted. It was previously smaller than the parent view and with that it expanded to fill the parent view. NB : I removed the scrollbars of the collection view and inner items are NSBox. Ps : this what I have without any resizing ;

Differences between NSTableView and NSCollectionView

末鹿安然 提交于 2019-12-04 18:02:45
I'm trying to decide which path to take for developing my Snow Leopard app. First, I should preface with the obvious differences: NSTableView can have multiple columns of data for representing different parts of the same "element" of data (a row) where NSCollectionView can display a grid of data as well, but every row+column combo is its own element. For my purposes, assume I'm dealing with a single column. As far as I can tell, NSCollectionView items are NSView s which all must be of the same dimensions. Also, unlike NSTableView , collectionview items are copied to the NSCollectionView