开发者

Set text of UISwitch in XCode

开发者 https://www.devze.com 2023-04-04 01:24 出处:网络
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开发者_如何学Go in the sourcecodeCustomizing the switch it

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开发者_如何学Go in the sourcecode


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消