You know about -[UISwitch setOnImage:]
and -[UISwitch setOffImage:]
, right? Also -[UISwitch setTintColor]
. About the only drawback I can see is that the switch, itself, will be the standard iOS switch (round button) but, otherwise, this would be the most-iOS-like solution.
When implementing your own on/offImage, remember the size restrictions, and also that the side of the image toward the switch is concave. tintColor
can be used to make the rest of the switch reflect your color scheme. You might want to track the valueChanged
event so alter the tint color.
If you need the exact look you display in your question (square switch button), then you probably want to use a custom control, as @Caleb suggested.