ARC and post-Yosemite compatibility
Thanks for this great work. I'm too lazy to clone/edit/make a pull request to make the button Yosemite-compliant, but here are 2 things to fix when embedding into a "modern" XCode project:
- ARC now disallows every [autorelease]. Just remove them and this will do.
- ARC also disallows
stuff = NSZoneMalloc([self zone], sizeof(struct PRHOOBCStuffYouWouldNeedToIncludeCarbonHeadersFor));. Write
stuff = malloc(sizeof(struct PRHOOBCStuffYouWouldNeedToIncludeCarbonHeadersFor));instead.
This should now compile, but doesn't work. The old-fashioned checkbox is still visible. This is due to Apple having more-or-less deprecated [NSControl setCellClass]. As a workaround (that may be changed again when Apple will completely deprecate it) :
In XCode interface builder, also change the class of the checkbox cell. It is hard to select the cell it with the mouse, as it is located at the same place as the checkbox. To do so, using the tree-list of the views (Editor > Show Document Outline menu) may help. Select the cell, turn its class into an
OnOffSwitchControlCell and off you go!