nstableview

Create a custom cell in a NSTableView

巧了我就是萌 提交于 2019-11-30 06:58:40
In my app I'm trying to create a custom cell like the follow: I know how to do that with iOS and I guess it should be quite the same by using OS X. So in interface builder I designed the table view but I can figure how to create a custom cell. I tried to insert in the .xib in which I designed the table view the custom component I need (2 NSTextField and 2 NSImageView ), then I create a class "CustomCell.m" and "CustomCell.h" as subclass of NSTableCellView , so I tried to connect my component to this class, but I can't add it... Why I can't connect the component to "CustomCell" class? What's

How to determine if a user has scrolled to the end of an NSTableView

寵の児 提交于 2019-11-30 06:41:02
问题 I have an NSTableView, and I would like to know when the user has scrolled to the bottom, so I can perform an action. Not quite sure how to go about this? UPDATE: Here is how I am calculating the bottom of the table: -(void)tableViewDidScroll:(CPNotification) notification { var scrollView = [notification object]; var currentPosition = CGRectGetMaxY([scrollView visibleRect]); var tableViewHeight = [messagesTableView bounds].size.height - 100; //console.log("TableView Height: " +

Hiding NSTableView header?

前提是你 提交于 2019-11-30 06:02:31
How do I hide an NSTableView header completely, so that it does not take any space up? Brian Webster In Interface Builder, select the table view, open the attributes inspector (alt-command-4), and uncheck the "Headers" checkbox in the "Columns" section. You can also set the headerView programmatically without subclassing [tableView setHeaderView:nil]; To do this programmatically, you can subclass NSTableView (or any NSTableView child class) and return nil for the headerView variable: @interface AppTableView : NSTableView { } @end @implementation AppTableView - (NSTableHeaderView *)headerView{

How do you add a toolbar to the bottom of an NSTableView?

穿精又带淫゛_ 提交于 2019-11-30 05:06:17
Check the following image, how can I add this kind of bar to my own NSTableViews? Other uses are in the network preferences app. What's the magic trick to make this work? I don't think there is any "magic trick." This is something you will have to implement yourself. It looks like a group of Gradient style NSButtons placed below the table view. An NSSegmentedControl in Small Square style would work too. 来源: https://stackoverflow.com/questions/9621661/how-do-you-add-a-toolbar-to-the-bottom-of-an-nstableview

Add/remove rows to/from NSTableView in Objective-C

元气小坏坏 提交于 2019-11-30 04:37:05
问题 I'm making a simple Todo application in Cocoa. I have added a class (and an NSObject to the XIB) MATodoController: MATodoController.h #import <Cocoa/Cocoa.h> @interface MATodoController : NSObject { IBOutlet NSTableView *table; } - (IBAction)addItem:(id)sender; - (IBAction)removeItem:(id)sender; @end MATodoController.m #import "MATodoController.h" @implementation MATodoController - (void)addItem:(id)sender { } - (void)removeItem:(id)sender { } @end I have an outlet 'table' to an NSTableView

NSTableView only displaying “Table View Cell”

本秂侑毒 提交于 2019-11-30 04:21:55
I have a NSTableView with the delegate and datasource pointing to my controller. I have tried implementing the - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex Method, but no matter what I return, the table always shows "Table View Cell" in the data. Any ideas of what I could be doing wrong? Attached are two pics showing that I have the delegates set properly (it also shows the proper number of rows). Note that I have also just tried returning @"Hello World" for everything, but I get the same result. JAWZapps Just change

Drag & Drop Reorder Rows on NSTableView

拥有回忆 提交于 2019-11-30 00:25:48
I was just wondering if there was an easy way to set an NSTableView to allow it to reorder its rows without writing any pasteboard code. I only need it to be able to do this internally, within one table. I have no issue writing the pboard code, except that I'm fairly sure that I saw Interface Builder have a toggle for this somewhere / saw it working by default. It certainly seems like a common enough task. Thanks FluffulousChimp If you take a look at the tool tip in IB you'll see that the option you refer to - (BOOL)allowsColumnReordering controls, well, column reordering. I do not believe

NSTableView & NSOutlineView editing on tab key

蓝咒 提交于 2019-11-29 20:06:47
问题 My app has an NSOutlineView and an NSTableView , and I'm having the same problem with both. With a row in either selected, pressing the tab key puts the first column into edit mode instead of making the next key view first responder. To get to the next key view, you need to tab through all of the columns. Also, shift-tabbing into either view results in the last column going into edit mode, necessitating more shift-tabs to get into its previous key view. In case it matters, I'm using the

How to setup a NSTableView with a custom cell using a subview

社会主义新天地 提交于 2019-11-29 17:23:35
I am trying to setup a NSTableView with a custom cell using an ArrayController and Bindings . To accomplish this I added a subview to the custom cell. The data connection seems to work somewhat. Though, there seems to be a redraw problem which I cannot fix. When I load the application only some of the cells are rendered. When I scroll through the rows or select one the rendering changes. I created an example project on github to illustrate what the problem is. The actual source code for the cell rendering can be found here : // CustomCell.m - (void)drawInteriorWithFrame:(NSRect)cellFrame

NSTextField in NSTableCellView

爷,独闯天下 提交于 2019-11-29 15:38:28
问题 I have a view based NSTableView with a custom NSTableCellView. This custom NSTableCellView has several labels (NSTextField). The whole UI of the NSTableCellView is built in IB. The NSTableCellView can be in a normal state and in a selected state. In the normal state all text labels should be black, in the selected state they should be white. How can I manage this? 回答1: Probably the easiest way to accomplish this would be to subclass NSTextField and to override the drawRect: method in your