nscell

NSCell with divisions

回眸只為那壹抹淺笑 提交于 2020-03-03 12:49:24
问题 I want to know if there is a way of drawing an NSCell like the following sample. The idea is to fit in the same column, 3 rows, the first one with enough space for a Title, and the rest with 2 columns. TITLE_ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ ____ DATA_TITLE_1: DATA_VALUE_1 _ _ _ DATA_TITLE_2: DATA_VALUE_2 DATA_TITLE_3: DATA_VALUE_1 _ _ _ DATA_TITLE_4: DATA_VALUE_2 Notes: The "_ _ _" were suposed to be three spaces (I don't know how to represent

NSCell with divisions

杀马特。学长 韩版系。学妹 提交于 2020-03-03 12:49:06
问题 I want to know if there is a way of drawing an NSCell like the following sample. The idea is to fit in the same column, 3 rows, the first one with enough space for a Title, and the rest with 2 columns. TITLE_ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ ____ DATA_TITLE_1: DATA_VALUE_1 _ _ _ DATA_TITLE_2: DATA_VALUE_2 DATA_TITLE_3: DATA_VALUE_1 _ _ _ DATA_TITLE_4: DATA_VALUE_2 Notes: The "_ _ _" were suposed to be three spaces (I don't know how to represent

NSTextFieldCell's cellSizeForBounds: doesn't match wrapping behavior?

懵懂的女人 提交于 2019-12-30 13:55:43
问题 It seems to be commonly accepted that cellSizeForBounds: allows one to calculate a text field's "natural" size. However, for NSTextField, I've found that it doesn't quite match: @interface MyTextField : NSTextField @end @implementation MyTextField - (void)textDidChange:(NSNotification *)notification { [super textDidChange:notification]; [self validateEditing]; // Forces updating from the field editor NSSize cellSize = [self.cell cellSizeForBounds: NSMakeRect(0, 0, self.bounds.size.width,

Hiding the lupe icon of a NSSearchField

我的梦境 提交于 2019-12-22 11:28:44
问题 I’m using a NSSearchField (not subclassed). When it’s not focused, the placeholderString is centered. But the lupe icon on the left appears a bit offset, so in fact the whole thing appears not to be centered. Is it possible to hide the lupe icon? 回答1: There is not any direct access to the icon, so that a workaround is first access to the NSSearchField cell (casted as shown), and afterwards access to its button cell. self in this example is an instance of NSSearchField [(NSButtonCell *)[

How to create a NSTextFieldCell, that in edit mode displays a custom view instead of NSTextField?

两盒软妹~` 提交于 2019-12-22 00:09:28
问题 I have a tableView, with 3 columns containing NSTextFieldCell. Everything is populated with bindings. The text of the cells of one of the column is computed and is not editable directly. For this column, I would like when the cell goes into edit mode , to display a button or a custom view instead of the textField . Said in an other way, I want an NSCell that is a NSTextFieldCell when not being edited, and a NSButtonCell (or a custom view) when being edited. Any hint to move on to this? Here

NSCell vs NSView: when many controls are needed

不想你离开。 提交于 2019-12-21 21:03:39
问题 I am aware that Apple is deprecating the use of NSCell in favour of NSView (see AppKit 10.10 release notes). It was previously recommended that NSCell be used for performance reasons when many controls were needed. I have spent considerable time implementing a custom control that required many subViews and the performance using NSView-type subViews was not good. See related stackoverflow discussion What are the practical limits in terms of number of NSView-type instances you can have in a

In OS X 10.10, can I implement an NSControl without an NSCell?

社会主义新天地 提交于 2019-12-20 12:41:14
问题 I am learning about NSControl . I am aware that NSCell has begun its road to deprecation in OS X 10.10 Yosemite, and so I'd rather not use an API that is going away. Also, the NSControl Class Reference shows all cell accessors have been deprecated. I understand all this, but what is not as clear is what the recommended course is for people writing NSControl subclasses on 10.10. All of the Apple guides on the subject make no mention of the deprecation of NSCell . I suppose I could just do

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

可紊 提交于 2019-12-18 09:39:36
问题 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

NSTableView Drag and Drop not working

橙三吉。 提交于 2019-12-13 14:15:00
问题 I'm trying to set up very basic drag and drop for my NSTableView. The table view has a single column (with a custom cell). The column is bound to an NSArrayController, and the array controller's content array is bound to an NSArray on my controller object. The data displays fine in the table. I connected the dataSource and delegate outlets of the table view to my controller object, and then implemented these methods: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet

Setting Multiline Title To NSButton In Cocoa App

不打扰是莪最后的温柔 提交于 2019-12-13 08:17:42
问题 I understand the NSButton guidelines for setting title to NSButton, No offence but the requirement should be fulfilled in my case. I want to show NSButton title in two lines. NSButton *btn = [[NSButton alloc] init]; [btn setTitle:@"multiple line text if longer title"]; the result I wanted was kind of below -: 回答1: I have fulfilled the requirement by subclassing the NSButton and then checked the title's string length to divide string accordingly to show it in two line. NSArray *arrStr = [str