Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSControl's setCellClass is deprecated in OS X 10.10 what's the alternative for overriding NSTextField's cell class?

I'm attempting to follow the post linked below to override the NSCell of a NSTextField but it looks like the setCellClass method is now deprecated in OSX 10.10.

How to make NSTextField use custom subclass of NSTextFieldCell?

How should one override the NSTextField's cell substituting it for a subclass?

The reason for doing this is to vertically centre the text of a NSTextField cell which Apple have made very difficult.

like image 480
Camsoft Avatar asked Mar 02 '15 12:03

Camsoft


1 Answers

public override class var cellClass: AnyClass? { get { YourCustomCell.self } set {} }

on the NSControl subclass seems to work.

like image 151
freyaariel Avatar answered Oct 12 '22 13:10

freyaariel