Martin Huwa
Martin Huwa

Reputation: 7

Set text of UISwitch in XCode

How can I set the text of the left and right label of a UISwitch in XCode4 (iOS4) ?

Searched for a solution but need a simple direct solution in the sourcecode

Upvotes: 0

Views: 4581

Answers (2)

JonasG
JonasG

Reputation: 9324

Customizing the switch itself is I think impossible, and if possible only using private APIs, and could cause a lot of problems depending on the firmware. An App Store safe way is using a UISlider.

Upvotes: 0

chown
chown

Reputation: 52778

From UISwitch Reference: The UISwitch class is not customizable.

Use a UISegmentedControl instead with 2 segments and [segControl setMomentary:NO], then use the - (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment method to set the title.

Upvotes: 0

Related Questions