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 things the old way, but then I'd need to change my code when Apple advances the deprecation of NSCell
to the next level.
Is it even possible to implement an NSControl
subclass without using NSCell
at all?
Can anyone provide advice or link me to a resource on this subject? This is proving difficult to google.
I'm trying to work this out as well. I can't unfortunately answer all your questions, but here's what I've found so far.
The AppKit Release Notes for OS X v10.10 have a brief explanation of what is happening, which I originally saw in the question How to create a custom themed NSButton without subclassing NSButtonCell?.
The 10.10 documentation does have many NSControl methods crossed out in red. (By the way, I'm not sure if this unambiguously means "deprecated".)
The documentation markings for
continuous
andenabled
are misleading, however. I've looked through the header file forNSControl
at the declarations that are crossed out in the docs and there seem to be a few different things going on:This method is deprecated with
NS_DEPRECATED_MAC
:These methods appear in an
NSDeprecated
category: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've been removed completely:
These declarations were previously methods, but have been refactored into properties. See this answer for details about what happened to the isEnabled / setEnabled methods. So these declarations are crossed out in the docs, but this is misleading:
I haven't found any good information about how to create an
NSControl
subclass without also creating anNSCell
subclass, although apparentlyNSColorWell
is a cell-lessNSControl
.My current rough conclusion is that
NSControl
is coupled fairly strongly toNSCell
, and it isn't sensible to use one without the other. So I'm considering writing anNSView
subclass instead.I'd also appreciate more information and advice here!