nstablecolumn

NSTableView with multiple columns

左心房为你撑大大i 提交于 2019-12-05 02:48:28
问题 What is an easy way to set up my NSTableView with multiple columns to only display certain data in one column. I have the IBOutlets set up, but I don't know where to go from there. 回答1: Assuming you're not using Cocoa Bindings/Core Data, you can display data in an NSTableView by implementing two methods from the NSTableViewDataSource protocol. Typically your controller will implement the protocol, so open the controller .m file and add these methods to the controller's @implementation : -

How to disable sorting in NSTableVIew?

拥有回忆 提交于 2019-12-04 20:02:36
问题 I have a an NSTableView when ever I click on a specific header column the data in the table get reversed or sort upside down. I have checked NSTableView as well as NSTableColumn but couldn't find any method that disables this. I would be obliged if anyone can help in disabling this sorting on clicking on the header of a particular column. 回答1: Sorting of the NSTableView is done by its sortDescriptors , see here. An NSTableColumn uses its sortDescriptorPrototype (see here) to generate the sort

Core Data Image Won't Load Into NSTableView Image Cell

久未见 提交于 2019-12-04 06:10:09
问题 In my code I am storing an image into my Core Data model (works fine). If I set up my view to have an NSImageView and bind its Data to Controller Key: selection and modelKeyPath: myImagePath, it works. It will show each image for the selected row. I then create a new column in my NSTableView and drag an image cell onto the column. However, I cannot get my Core Data bindings to have the image show up in the cell. I have tried binding both value and data, but no luck. Since I am sure the image

NSTableView with multiple columns

感情迁移 提交于 2019-12-03 17:11:49
What is an easy way to set up my NSTableView with multiple columns to only display certain data in one column. I have the IBOutlets set up, but I don't know where to go from there. Assuming you're not using Cocoa Bindings/Core Data, you can display data in an NSTableView by implementing two methods from the NSTableViewDataSource protocol. Typically your controller will implement the protocol, so open the controller .m file and add these methods to the controller's @implementation : - (NSInteger)numberOfRowsInTableView:(NSTableView*)tableView { return 25; // fill this out } – (id) tableView:

Why are my images in my NSTableView faded out?

落花浮王杯 提交于 2019-12-03 13:45:18
To start, there's an NSArrayController ("Servers") whose content is an array of "server" objects. I also have an NSTableView with a column. The column is bound to Server's "arrangedObjects.status" property. I use a custom NSValueConverter to make that status into an image for the column's dataCell which is an NSImageCell . What I don't understand is why the images that show up in the column are correct, but consistently faded out. Just to test, I have the same image outside the table view for comparison and it draws fine. The colors in the images are not semi-transparent. Does the NSImageCell

How to disable sorting in NSTableVIew?

青春壹個敷衍的年華 提交于 2019-12-03 12:54:01
I have a an NSTableView when ever I click on a specific header column the data in the table get reversed or sort upside down. I have checked NSTableView as well as NSTableColumn but couldn't find any method that disables this. I would be obliged if anyone can help in disabling this sorting on clicking on the header of a particular column. Sorting of the NSTableView is done by its sortDescriptors , see here . An NSTableColumn uses its sortDescriptorPrototype (see here ) to generate the sort descriptor of the NSTableView , depending on how many times you clicked the column header, etc. If you

Core Data Image Won't Load Into NSTableView Image Cell

折月煮酒 提交于 2019-12-02 08:22:36
In my code I am storing an image into my Core Data model (works fine). If I set up my view to have an NSImageView and bind its Data to Controller Key: selection and modelKeyPath: myImagePath, it works. It will show each image for the selected row. I then create a new column in my NSTableView and drag an image cell onto the column. However, I cannot get my Core Data bindings to have the image show up in the cell. I have tried binding both value and data, but no luck. Since I am sure the image is stored properly, what am I doing wrong in my binding to prevent the image from showing up in the

How to add columns in Cocoa NSTableView?

倖福魔咒の 提交于 2019-11-29 13:02:52
I want to show data in NSTableView. The number of columns is unspecified (could be any from 1 to ?? depending on the data), so I can't use Interface Builder. So I initialize (with IB) my table to 1 column, and thereafter add new columns as required (then remove the no-longer needed 0-th column). To each added column I provide a unique identifier. So far so good. I implement the tableView(-:viewForTableColumn:row) function, as shown below, but the makeViewWithIdentifier returns nil . What's the matter ? If I detect the nil return, I create an instance of NSTableCellView with the proper

Create view based NSTableView programmatically using Bindings in Swift

馋奶兔 提交于 2019-11-29 07:52:31
I am working through a Cocoa in Swift book and I am stuck in a chapter on Bindings. The book uses nib files but I want to do everything programmatically (since I am joining a team that does not use nibs). The project is to create a view based table with 2 columns and the content of the table is bound to the arrangedObjects of an array controller. The array controller's content is bound to an array of Employee objects (Employee has 2 properties viz. name and salary). I was able to create the table programmatically like below (one scroll view, one table view, 2 table columns): let tableWidth =

How to add columns in Cocoa NSTableView?

感情迁移 提交于 2019-11-28 06:48:30
问题 I want to show data in NSTableView. The number of columns is unspecified (could be any from 1 to ?? depending on the data), so I can't use Interface Builder. So I initialize (with IB) my table to 1 column, and thereafter add new columns as required (then remove the no-longer needed 0-th column). To each added column I provide a unique identifier. So far so good. I implement the tableView(-:viewForTableColumn:row) function, as shown below, but the makeViewWithIdentifier returns nil . What's