I am also trying to do this. Unfortunately, I cannot answer all your questions, but here is what I have found so far.
The AppKit release notes for OS X v10.10 contain a brief explanation of what is happening, which I initially saw in the question How do I create a custom NSButton without subclassing NSButtonCell? .
NSCell gradual rejection
Mac OS X 10.10 takes another step towards the final cell. Direct access to the control's cell is discouraged and the methods that allow it will formally become obsolete in a future release. A variety of cell-level APIs were control subclasses to provide easy access to important functionality. NSLevelIndicator, NSTextField, NSSearchField, NSSlider, and NSPathControl have new properties for this purpose. Cellular NSTableViews are now deprecated, and view-based NSTableViews should be used instead. Matrix NSBrowsers are also deprecated in favor of an element-based interface.
There are many NSControl methods highlighted in red in the 10.10 documentation. (By the way, I'm not sure if this definitely means "deprecated.")
Documentation marking for continuous and enabled is misleading. I looked at the header file for NSControl in the ads that are crossed out in the documents, and it seems that several different events are happening:
This method has been deprecated with NS_DEPRECATED_MAC :
// Use formatters instead. See -[NSControl formatter] and -[NSControl setFormatter:]. - (void)setFloatingPointFormat:(BOOL)autoRange left:(NSUInteger)leftDigits right:(NSUInteger)rightDigits NS_DEPRECATED_MAC(10_0, 10_0);
These methods appear in the NSDeprecated category:
@interface NSControl (NSDeprecated) // Use formatters instead. See -[NSControl formatter] and -[NSControl setFormatter:]. - (void)setFloatingPointFormat:(BOOL)autoRange left:(NSUInteger)leftDigits right:(NSUInteger)rightDigits NS_DEPRECATED_MAC(10_0, 10_0); + (void)setCellClass:(Class)factoryId; + (Class)cellClass; - (id)cell; - (void)setCell:(NSCell *)aCell; - (id)selectedCell; - (NSInteger)selectedTag; - (void)setNeedsDisplay; // Use setNeedsDisplay:YES instead. - (void)calcSize; - (void)updateCell:(NSCell *)aCell; - (void)updateCellInside:(NSCell *)aCell; - (void)drawCellInside:(NSCell *)aCell; - (void)drawCell:(NSCell *)aCell; - (void)selectCell:(NSCell *)aCell; @end
These methods appear in the documentation as “Available in OS X v10.8 through OS X v10.9”, but not in the NSControl header file, so I assume they are completely removed:
-userInterfaceLayoutDirection -setUserInterfaceLayoutDirection
These declarations were previously methods, but were reorganized into properties. For more on what happened to the isEnabled / setEnabled methods, see this answer . Thus, these declarations are crossed out in the documents, but this is misleading:
@property (getter=isContinuous) BOOL continuous; @property (getter=isEnabled) BOOL enabled;
I did not find any good information on how to subclass NSControl without creating a subclass of NSCell , although apparently NSColorWell is without an NSControl cell.
My current crude conclusion is that NSControl quite strongly associated with NSCell , and it is not wise to use it without the other. Therefore, I am considering the possibility of subclassing NSView .
I would also like to get more information and tips here!
source share