nstextfieldcell

setScrollable not working for NSTextFieldCell

十年热恋 提交于 2019-12-31 05:05:17
问题 I want my each table cell to be scrollable since its editable.I am using self.nsChildTextFieldObj = [[NSTextFieldCell alloc] init]; [self.nsChildTextFieldObj setControlView:self.controlView]; [self.nsChildTextFieldObj setBackgroundStyle:self.backgroundStyle]; [self.nsChildTextFieldObj setScrollable:YES]; [self.nsChildTextFieldObj setFont:[NSFont fontWithName:appDelegate.selectedFont size:appDelegate.selectedFontSize]]; [self.nsChildTextFieldObj setEditable:NO]; but my table view cell is not

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,

Invalid color System, labelColor (warning given only once)

跟風遠走 提交于 2019-12-30 08:12:11
问题 I am getting following warning on OS X 10.9 console at the time of nib load( NSWindowController ). Invalid color System, labelColor (warning given only once) I am using Xcode 6 and OS X 10.10 to compile my code. Most probably this warning is coming because of NSColor exposes new system colors in 10.10 for static text and related elements: labelColor, secondaryLabelColor, tertiaryLabelColor, and quaternaryLabelColor. How to fix this warning? 回答1: Change your textfield's color in your xib file

Invalid color System, labelColor (warning given only once)

拥有回忆 提交于 2019-12-30 08:11:05
问题 I am getting following warning on OS X 10.9 console at the time of nib load( NSWindowController ). Invalid color System, labelColor (warning given only once) I am using Xcode 6 and OS X 10.10 to compile my code. Most probably this warning is coming because of NSColor exposes new system colors in 10.10 for static text and related elements: labelColor, secondaryLabelColor, tertiaryLabelColor, and quaternaryLabelColor. How to fix this warning? 回答1: Change your textfield's color in your xib file

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

Drawing a rounded cornered NSTextFieldCell

╄→尐↘猪︶ㄣ 提交于 2019-12-20 03:55:14
问题 My code for my NSTextFieldCell is: - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { // Drawing code here. NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor lightGrayColor] endingColor:[NSColor grayColor]]; [gradient drawInRect:cellFrame angle:90]; [[self title] drawInRect:cellFrame withAttributes:nil]; } I would like to have the NSTextFieldCell to have rounded corners.... how could I do this? 回答1: Use the layer property of NSView, then you

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: selecting non-editable CELLS and not ROWS

两盒软妹~` 提交于 2019-12-11 19:43:48
问题 I've tried numerous combinations of suggested options from other posts, but I can't seem to get a cell-bassed NSTableView populated with non-editable NSTextFieldCell to select the CELL and not the row. I've tried: [[col dataCell] setEditable:NO]; [[col dataCell] setSelectable:YES]; [col setEditable:YES]; and tried delegates: - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex; and - (BOOL)shouldFocusCell:(NSCell *)cell atColumn:(NSInteger)column row:(NSInteger)row;

What is the easiest way to custom NSTableView cell?

半世苍凉 提交于 2019-12-11 01:43:57
问题 I'm an iOS developer. I recently started my Mac project, but I found that unlike UITableViewCell, which is a subclass of UIView, the cell of NSTableView is NSCell, and I even can't create it in IB. I wonder if there are some easy ways to create subclass like NSTextFieldCell to put it into the NSTableView. Any help would be appreciated! Thanks! 回答1: Have a look at the open source PXListView class on Github This has a PXListViewCell that you can use as an example. 来源: https://stackoverflow.com

How to make NSTextField use custom subclass of NSTextFieldCell?

梦想的初衷 提交于 2019-12-10 04:12:16
问题 I've been looking for a solution to make my NSTextField bottom-aligned and I've found this and adjusted it for my needs. So now I have this custom NSTextFieldCell but how do I tell my NSTextFields to use this class (programmatically)? 回答1: Have you tried setCell: method of the NSControl class? - (void)setCell:(NSCell *)aCell 回答2: Since you ask how to do it programmatically, you can also use the setCellClass: method on your NSTextField subclass. Call it in the load or initialize class methods: