1. Dain Kaplan
  2. Cocoa On/Off Switch Control
  3. Issues
Issue #2 resolved

ARC and post-Yosemite compatibility

daladim
created an issue

Hi,

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!

Comments (2)

  1. Dain Kaplan repo owner

    Thanks for the comments; I've gone ahead and upgraded the project to ARC.

    Regarding the setCellClass issue, the readme has a note about manually setting this, so with the workaround It's probably okay for now.

  2. Log in to comment