You can use UIButton and two images so that they appear as a vertical toggle switch and swap images depending on the state of the switch.
Subclass of UIButton, add switch state, image sharing, etc., use as needed.
EDIT . Another way is a fully customizable control. You subclass UIControl and add functions similar to UISwitch (i.e.: initWithFrame, on, setOn: animated :).
You also need to send an event with state changes, similar to what UISwitch does:
[self sendActionsForControlEvents: UIControlEventValueChanged]
You implement beginTrackingWithTouch, continueTrackingWithTouch and endTrackingWithTouch to move the switch images as the sensor moves along the switch. I did this to create a 2D slider. UISwitch also performs its localization, for example, ON / OFF changes to 0/1.
progrmr
source share