Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the text on a UISwitch

The UISwitch currently says ON and OFF. Can I change the text to YES and NO?

Would it be hard? Or do I just rephrase the question I ask the user?

like image 630
Sam Jarman Avatar asked Apr 26 '10 04:04

Sam Jarman


2 Answers

As of iOS 6, you can set

@property(nonatomic, retain) UIImage *offImage;
@property(nonatomic, retain) UIImage *onImage;

Docs say:

This image represents the interior contents of the switch. The image you specify is composited with the switch’s rounded bezel and thumb to create the final appearance.

The size of this image must be less than or equal to 77 points wide and 27 points tall. If you specify larger images, the edges may be clipped.

like image 167
c roald Avatar answered Oct 28 '22 08:10

c roald


I've done exactly this in iOS 6 with onImage and offImage, here are the images I used:

enter image description here

enter image description here

enter image description here

enter image description here

like image 35
Allen Zeng Avatar answered Oct 28 '22 07:10

Allen Zeng