开发者

UISwitch custom

开发者 https://www.devze.com 2023-02-20 18:52 出处:网络
I should customize开发者_开发问答 a UISwitch with YES and NO instead of ON and OFF, what can I do? I don\'t know the code for make it.The documentation doesn\'t show properties for changing the style

I should customize开发者_开发问答 a UISwitch with YES and NO instead of ON and OFF, what can I do? I don't know the code for make it.


The documentation doesn't show properties for changing the style of a UISwitch, the way I've always implemented such a feature was using a UISlider, and you can set the properties only via code (the advanced properties at least). For "yes" and "no" you can make images to set to the left and right side of the slider, and for the transition effect you can use a normal animation function

[UIView animationWithDuration:0.1f animation^(void){
   //code here
}completion(BOOL finished){
   // set the picture here so that you don't see a squished imaged get enlarged
}];

I don't know the properties off the top of my head so you will have to play around with it, it's probably UISlider.layer.property so once you type the second . then a list should come up which you can scroll through to find what matches what you are looking for, but don't quote me, I'm not exactly sure on that.

0

精彩评论

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