nstableview

Draw Text with a border and background for a NSTableView cell

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 06:56:05
问题 I have a cell-based tableview and I want to display some sort of tags within this tableview, preferably without having to use a view-based tableview. Is there an elegant way to achieve something like the example here (HTML), ideally with a background-color as well. 回答1: If you want to stick with a cell-based table view, you can subclass NSCell and override: - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { NSRect insetRect = NSInsetRect(cellFrame, 2.0, 2.0); NSBezierPath*

How can an NSCell detect the model key path it's bound to?

别说谁变了你拦得住时间么 提交于 2019-12-11 06:36:18
问题 Imagine the following: You have an NSTableView with multiple columns. Each NSTableColumn is bound to the same NSArrayController (we'll call it myArrayController ). This array controller holds many instances of a model class. One column has an NSPopupButtonCell where selectedObject is bound to myArrayController.arrangedObject.somePropertyOfTheModel . The table gets properly populated. Q : How can an NSCell detect the model key path it's bound to? ( somePropertyOfTheModel in this example) I'm

About the automatic table column identifier

可紊 提交于 2019-12-11 04:38:58
问题 I have create a NSTableView and 2 NSTableColumn in the view. Both of the identifiers of these 2 NSTableColumn set to "Automatic" in Interface Builder. In the method: (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row I use NSLog(@"%@", [tableColumn identifier]) to check the identifier of these 2 NSTableColumn. I found the identifier of the first column is AutomaticTableColumnIdentifier.0 but the second is (null) . Is there any

Cocoa binding NSTableView within NSTableView

夙愿已清 提交于 2019-12-11 03:42:33
问题 I'm trying to display a NSTableView inside a NSTableView. This is for an iTunes-like albums/tracks view. So there's a list of 10 albums, each album has some tracks. I want to display the albums in the outer table view and the tracks for each album in the inner. The first NSTableView is bound to an NSArrayController. Each object in the array has its own "tracks" NSArrayController, but I can't figure out how to tell the 'tracks' NSTableView that its content comes from a property of the 'album'

Calling makeViewWithIdentifier:owner: causes ARC to re-create ivar

坚强是说给别人听的谎言 提交于 2019-12-11 03:27:56
问题 I'm writing a sandboxed ARC app with a view-based NSTableView that accepts dragged-and-dropped files ( NSURL s). I ran into some significant strangeness in the following NSTableViewDelegate method: - (NSView *)tableView:(NSTableView *)tv viewForTableColumn:(NSTableColumn *)tc row:(NSInteger)row { // `files' is an NSMutableArray* ivar containing NSURLs // that have been dropped into this table NSURL *url = [files objectAtIndex:row]; NSString *fileName = [url lastPathComponent]; NSImage *icon =

Master-detail using bindings with TWO NSTableViews

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:42:39
问题 I have a list of objects displayed in an NSTableView (bound to an NSArrayController). When you select an object in that list I want to show a detail view in a second NSTableView. My object has an array property. I can't figure out how to wire the bindings for this. binding to NSArrayController's selection doesn't work, as that's a single object, and NSTableView expects to be bound to an array... 回答1: Create a second NSArrayController and bind its contents to the first controller using a

NSButtonCell of Check type within NSTableView does not allow to have value changed

情到浓时终转凉″ 提交于 2019-12-11 02:29:41
问题 I have window with 3 table views (10.7.2, Xcode 4.2). They are all created in IB and NSButtonCells are connected with outlets. I created controller class and I filled all three views with some sample data: - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { return 10; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { NSButtonCell *buttonCell; if(aTableView == dimensionTable) { [dimensionButtonCell

NSTableView select row by pressing “space”

跟風遠走 提交于 2019-12-11 01:58:32
问题 I didn't find any information on this question, and I wonder if it is possible to make NSTableView (or subclass) to select rows by pressing space bar on keyboard, and navigate through rows by pressing up/down keys without the selection being reset. I want to make nstableview to behave like total commander's file panel, if someone used it under windows. And I don't even know where to start. 回答1: You will have to make subclass of the NSTableView class. This is basic example how you could do it.

Table view not updating according to bindings - Part Two

女生的网名这么多〃 提交于 2019-12-11 01:54:11
问题 Title borrowed from this question, of which this one is not a duplicate. See my answer there for what was wrong for that questioner; I'm the author of that answer, and my problem is not that one. I have a table view with three columns, whose Value bindings are bound to three properties of the arrangedObjects of an array controller. The array controller's contentArray is bound to the visitationResults of my document object; the items in that array are instances of a model class

Why does [[NSTableCellView alloc] init] produce a nil- text field?

允我心安 提交于 2019-12-11 01:43:58
问题 The log lines below will show "Table cell: [valid value logged here]" but "Text field: (null)". I'm actually trying to build an NSOutlineView programmatically, and it works with a cell-based approach, but not with a view-based approach. Can someone tell me what I'm doing wrong? -(NSView*)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item { NSTableCellView* view = [outlineView makeViewWithIdentifier:tableColumn.identifier owner:self]; if