nstableview

Layer-backed NSView animation

旧街凉风 提交于 2019-12-05 17:54:49
I have a certain NSView that I want to animate, but that NSView has a NSTableView inside which does not display correclty when the view is layer-backed (which in turn is nececessary to animate a view). So my answer was to make the view layer-backed right before animating, and then when the animation was done remove the layer, like this: [animatingView setWantsLayer: YES]; [NSAnimationContext beginGrouping]; [[animatingView animator] animateSomething]; [[NSAnimationContext currentContext] setCompletionHandler: ^{ [animatingView setWantsLayer: NO]; }]; [NSAnimationContext endGrouping]; However,

NSButtonCell in NSTableView: click handling

不想你离开。 提交于 2019-12-05 16:37:06
I set NSButtonCell as a cell type in a Table Column in my NSTableView . I implemented an IBAction method, but I can't wire it with NSButtonCell in IB - the wire don't want to highlight a button from NSTableView . How to connect a method with NSButtonCell ? Or maybe there'se another way to handle its click event? Thanks You should be able to wire up a connection from the cell by control+dragging to any object in your NIB. Just make sure the cell is actually selected, and that your action is defined as an IBAction in the object's header file. In your action method you can determine which row was

NSButton in NSTableCellView: How to find desired objectValue?

三世轮回 提交于 2019-12-05 15:22:08
I have a view-based NSTableView that is populated through bindings. My textFields & imageViews are bound to the NSTableCellView's objectValue's properties. If I want to have an edit/info button in my NSTableCellView: Who should be the target of the button's action? How would the target get the objectValue that is associated with the cell that the button is in? I'd ultimately like to show a popover/sheet based on the objectValue. Your controller class can be the target. To get the object value: - (IBAction)showPopover:(id)sender { NSButton *button = (NSButton *)sender; id representedObject = [

Layout still needs update after calling NSTableRowView layout

我是研究僧i 提交于 2019-12-05 14:47:30
I have two NSTableView's in my app and the user can drag and drop items from table A to table B. When dragging an item to table B Xcode gives me the following layout warning message: Layout still needs update after calling -[NSTableRowView layout]. NSTableRowView or one of its superclasses may have overridden -layout without calling super. Or, something may have dirtied layout in the middle of updating it. Both are programming errors in Cocoa Autolayout. The former is pretty likely to arise if some pre-Cocoa Autolayout class had a method called layout, but it should be fixed. This ever only

Problem naming NSTableColumn

偶尔善良 提交于 2019-12-05 11:55:59
I'm trying to create a column with an empty string as the identifier but Cocoa seems to replace the empty string with the word "Field" every time I try to create the column. How do you go around this? - (void)addColumnWithCheckboxToTable:(NSTableView *)table { // Add column with checkbox before all other columns // This column will have no title and should be as wide as the checkbox NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@" "] autorelease]; // The checkbox is to be initialised without a title NSButtonCell *checkbox = [[[NSButtonCell alloc] initTextCell:@" "]

How to create an action from selecting a row from an NSTableView

牧云@^-^@ 提交于 2019-12-05 10:46:14
问题 When I select a row from NSTableView , it is not running the code from tableViewSelectionDidChange method. I had put break points in this method and it is not even going into the method. Any ideas? Am I missing something in my initialiser? PersonController.h #import <Foundation/Foundation.h> @interface Person : NSObject { IBOutlet NSTableView *personsTable; NSMutableArray *personsList; NSMutableArray *personCollection; IBOutlet NSTextField *selectedPersonName; IBOutlet NSTextField

Cocoa osx NSTableview change row highlight color

独自空忆成欢 提交于 2019-12-05 08:35:53
In my application I have a view based NSTableView with one column. The highlight color of the rows is set to regular (blue). I need to change that color to my custom color. In the interface builder I tried changing it but the only options are "None, regular and source list". I tried this post solution with no success: https://stackoverflow.com/a/9594543/3065901 I read that I have to use this delegate method but I dont know how to use this. - (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row I tried drawing the row in that method but i get invalid context

How to add row-span in view-based NSTableView?

天涯浪子 提交于 2019-12-05 08:32:40
I'm trying to get a table layout as shown below working with view-based NSTableViews that have been introduced in Lion. There were multiple approaches described for cell-based NSTableViews, e.g. Mimic the artwork column , but these don't really apply for view based table views. The idea is that the table gets populated by an array of objects, in one (or more) column spanning rows indicating that objects share some data in common. numberOfRowsInTableView: returns to total number of items (19 in the case of the attached image). Has anyone tried something like this? Layout I was able to do this

How to set row height based on its content in table?

爱⌒轻易说出口 提交于 2019-12-05 06:52:36
Generally, table has a fixed row height but according to my requirements I need to set height of each row according to content within it. Can anyone suggest me some solution for it? Thanks, Miraaj The table view delegate protocol has a tableView:heightOfRow that lets you set the height of each row in the table view. Devarshi Thanks all for your suggestions and help. This problem is now resolved using following code in tableView:heightOfRow: float colWidth = [[[tableView tableColumns] objectAtIndex:1]width]; NSString *content = [[[tempArray objectAtIndex:row] objectForKey:@"tValue"] string];

CoreData-bound NSTableView loses input focus when items change, but only if sorted

*爱你&永不变心* 提交于 2019-12-05 06:15:26
问题 I have an NSTableView in a dialogue box which is bound to a collection of CoreData model instances via an NSArrayController in 'Entity Name' mode. The table displays the name s of the array of managed objects in a single column. This works well. The names in the table rows are editable. If the user edits a name when there is no sorting applied to the table then editing proceeds normally. After pressing Return, the new name is recorded and input focus stays in the NSTableView. However, if the