nstableview

Coloring rows in View based NSTableview

被刻印的时光 ゝ 提交于 2019-12-04 15:57:45
问题 I have a view based nstableview. I want to color entire row based on some condtion for which I have used code below - (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row { NSTableRowView *view = [[NSTableRowView alloc] initWithFrame:NSMakeRect(1, 1, 100, 50)]; [view setBackgroundColor:[NSColor redColor]]; return view;; } The delegate method is called, but table doesn't seem to be using NSTableRowView returned by delegate method. Main aim here is coloring entire

NSDictionaryController doesn't seem to observe changes to content dictionary

拜拜、爱过 提交于 2019-12-04 15:54:09
I must be missing something simple, but I am having some trouble binding a tableView to an NSDictionaryController. Here is a model of my current scheme: TableViewColumn --bindsTo-->DictionaryController.arrangedObjects.(value or key) --bindsTo-->someClass.someClassMember.aDictionary. I've tested the tableView by adding an entry to aDictionary on init, which is displayed correctly. But when another method produces an object that is then added to aDictionary, the TableView doesn't seem to update or even know that aDictionary now has two entries. I've tried everything I can think of. I am not

Adding footer in NSTableView

♀尐吖头ヾ 提交于 2019-12-04 15:51:26
I'm developing a Cocoa application for Mac. In the application, I have to add a footer to a table for adding and deleting rows like in the attached image: Is there any default controls present for such type of footer view? If there is no such default control, I have to use the image. There is no such default control. you can create a custom control like this or you can get this effect by taking a image and two buttons. Ziggy Stardust You can check out Bottom bar in NSWindow for a similar problem and suggestions to solve it! 来源: https://stackoverflow.com/questions/13138211/adding-footer-in

How Do you Drag-Move a Row in NSTableView?

情到浓时终转凉″ 提交于 2019-12-04 15:42:07
If it were an iOS project, letting the user drag-move the selected row would be relatively easy. I think it's something like - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ return UITableViewCellEditingStyleNone; } - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (BOOL)tableView:(UITableView *)tableview canMoveRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath

NSScrollView detect scroll position

烈酒焚心 提交于 2019-12-04 15:35:00
How can i detect scroll of position when the scroll at bottom? [[_scrollView contentView] setPostsBoundsChangedNotifications:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChangeNotification:) name:NSViewBoundsDidChangeNotification object:[_scrollView contentView]]; - (void) boundsDidChangeNotification: (NSNotification *) notification { NSPoint currentScrollPosition = [[_scrollView contentView] bounds].origin; } Update : My original answer was plain wrong. Thanks to JWWalker and Wil Shipley for making me aware of that via comments. Here's a hopefully

Dynamic row height for NSTableView in Swift/Cocoa

柔情痞子 提交于 2019-12-04 15:33:58
EDIT: The question was not answered by the linked reply. I'm still stuck on this... I've got a table that I use for chat messages. Each message is a variably-sized box including some text. I want the row height in my table to dynamically change depending on the size of the message box. If I tick 'automatic' for size style in IB, it makes all of the rows have tiny heights. It looks like iOS have UITableViewAutomaticDimension which automatically scales the table, but I can't find anything like that for NSTableView. I know there's an option to create the following function: func tableView(_

Xcode Swift. How to programmatically select Cell in view-based NSTableView

做~自己de王妃 提交于 2019-12-04 14:57:49
I can click a cell and edit its contents. But, instead of click/selecting a cell is it possible to programmatically select a cell - basically give a cell focus ready for editing. Somebody here on StackOverflow asked the same question about UITableView and the answer given was:- let indexPath = NSIndexPath(forRow: 2, inSection: 0) tableView.selectRowAtIndexPath(indexPath, animated: true, scrollPosition: .Middle) Does selectRowAtIndexPath select a cell? In any case, my NSTableView doesn't appear to have a .selectRowAtIndexPath(... method anyway. Please point me at a resource where I can get a

Reordering of NSTableview Rows in View based Tableview

蹲街弑〆低调 提交于 2019-12-04 14:41:44
As per apple documentation drag and drop NSTableView delegate methods are called only for cell based TableViews not for View based. So there is no way to do reordering of rows using drag & drop for view based NSTableView ? I have created a small sample project which has an NSOutlineView where you can add and remove items as well as reorder them. This is not an NSTableView but the implementation of the Drag & Drop protocol is basically identical. I implemented drag and Drop in one go so it's best to look at this commit . Drag and drop delegate methods get called fine in a view based NSTableView

Automatically adjust size of NSTableView

蓝咒 提交于 2019-12-04 12:49:04
I have an NSTableView, which should resize it's frame when a row is added. I would make 2 properties, maxHeight and minHeight, and if any rows are being added or removed, I would resize the table view to fit it's content, if it doesn't cross the limit. Like the Safari Download Panel (10.7 or later). Has anyone an idea how to do this? I would want to handle this in a subclass. So no messing with the resizing in the delegate class. I would at least need to know which method is being called when the table view is being reloaded. reloadTable only invokes the real reloading method, so no success

Filtering a single-column NSTableView using NSArrayController

佐手、 提交于 2019-12-04 12:17:45
I present a sheet with an NSTableView (one column), an NSSearchField and an NSButton ('Add'). What I want is to set the content of the table view to a list of strings. This list of strings is in an NSArray called list . This content should be filtered based on the content of the search field (if a string in list ) does not contain the content of the search field it is not shown in the table view anymore. I'm not familiar with bindings, can anyone help me out. I have uploaded a project , kindly check. A rough idea how to do is as: (however understanding is easier by seeing the project) Create