0

I need to use a custom "knob" image on a UISwitch. I don't think this is possible with the default SDK. Does anyone know how I might go about this or of any 3rd party libraries that can do this? I've found a few but they are all old and don't work with ARC.

soleil
  • 12,133
  • 33
  • 112
  • 183

1 Answers1

0

Generally to do something like this you would subclass UIControl. I'm sure there are a bunch of implementations of this particular control type floating around. I found one that you can use here. There is a github link on the page.

By the way, if you find a class you want to use that is not arc enabled, you can either try to convert it yourself (although this will make it harder to download updates for it), or more commonly add the -fno-objc-arc compiler flag to whatever files are not arc compatible and it will exclude them (but you can still use them). More info on that here.

Community
  • 1
  • 1
Dima
  • 23,484
  • 6
  • 56
  • 83
  • Thanks for the ARC tip, that works. Still looking around for a good UISwitch that lets you change the knob image. – soleil Jul 02 '12 at 22:28
  • The one I posted lets you change all of the images. Is there an issue with it? – Dima Jul 03 '12 at 14:17
  • It's a rotating knob, and I'm looking for an on/off switch. – soleil Jul 05 '12 at 05:49
  • You wrote that you want a switch with a "knob" image. Perhaps you could draw a picture? Because it's kind of unclear what you want. – Dima Jul 05 '12 at 18:18
  • I simply want a switch with custom images. It should still work like a switch. – soleil Jul 16 '12 at 18:00