nstableview

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

徘徊边缘 提交于 2019-11-29 02:55:18
问题 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? 回答1: 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

NSOutlineView reloadItem: has no effect

匆匆过客 提交于 2019-11-29 02:55:10
问题 I'm trying to release some strain on a view-based NSOutlineView for which I changed a single item property and which I initially reloaded just fine using [myOutlineView reloadData] . I tried [myOutlineView reloadItem: myOutlineViewItem] but it never calls - (NSView *)outlineView:(NSOutlineView *)ov viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item and consequently the data is not updated. -(void)reloadOutlineViewObject { //[myOutlineView reloadData]; //Reload data just fines but

NSTableView only displaying “Table View Cell”

最后都变了- 提交于 2019-11-29 01:38:07
问题 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

Drag & Drop Reorder Rows on NSTableView

时间秒杀一切 提交于 2019-11-28 21:22:33
问题 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 回答1: If you take a look at the tool tip in IB you'll see that the option you

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

让人想犯罪 __ 提交于 2019-11-28 20:56:28
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: " + tableViewHeight); //console.log("Current Position: " + currentPosition); if (currentPosition > tableViewHeight - 100)

Change NSTableView alternate row colors

谁说胖子不能爱 提交于 2019-11-28 20:32:15
I'm using the "Alternating Rows" option in Interface Builder to get alternating row colors on an NSTableView. Is there any way to change the colors of the alternating rows? If you want to use an undocumented way, make a NSColor category and override _blueAlternatingRowColor like this: @implementation NSColor (ColorChangingFun) +(NSColor*)_blueAlternatingRowColor { return [NSColor redColor]; } @end or to change both colors, override controlAlternatingRowBackgroundColors to return an array of colors you want alternated. @implementation NSColor (ColorChangingFun) +(NSArray*

NSTableview View Based Scrolling Performance

倾然丶 夕夏残阳落幕 提交于 2019-11-28 19:39:42
I am fairly new to OS X Cocoa programming but have decided to give it a go with the new Swift language. I have an NSTableView with 1500 rows (will be more) and 7 columns. There is one checkbox column and the rest are text fields, one with a date formate and one a currency formatter. I first set this up as cell based. Scrolling was buttery smooth (I even did a test adding 1 million rows, still smooth). This was under mavericks. I then upgraded to Yosemite , scrolling performance significantly degraded. Enabling Core animation layer checkbox on the table view improved this but was still worse

Automatically adjust height of a NSTableView

喜你入骨 提交于 2019-11-28 18:24:21
I have asked this question once before, but I'm just not very satisfied with the solution. Automatically adjust size of NSTableView I want to display a NSTableView in a NSPopover , or in a NSWindow . Now, the window's size should adjust with the table view. Just like Xcode does it: This is fairly simple with Auto Layout, you can just pin the inner view to the super view. My problem is, that I can't figure out the optimal height of the table view. The following code enumerates all available rows, but it doesn't return the correct value, because the table view has other elements like separators,

Is it possible to design NSCell subclasses in Interface Builder?

可紊 提交于 2019-11-28 18:20:11
I'm trying to subclass NSCell for use in a NSTableView. The cell I want to create is fairly complicated so it would be very useful if I could design it in Interface Builder and then load the NSCell from a nib. Is this possible? How do I do it? The question was about a subclass of NSCell; the other answers seem to be doing something else, likely taking advantage of UITableViewCell being a view. NSCell is not a view. While laying a custom cell out in IB would be a useful thing to be able to do, I think the answer is basically "no, this is not possible". When you subclass NSCell, you're pretty

Change selection color on view-based NSTableView

时光毁灭记忆、已成空白 提交于 2019-11-28 16:59:00
Standard highlighting color in OS X applications is blue. Is it possible to change it to another color, e.g. gray? Note that I am using the new view-based NSTableView available starting from OS X 10.7. Since you're using the view based NSTableView, you can subclass NSTableRowView, feed it to the table delegate method - (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row; , then customize your selection in the row view class. Here's an example: - (void)drawSelectionInRect:(NSRect)dirtyRect { if (self.selectionHighlightStyle != NSTableViewSelectionHighlightStyleNone