UI切换自定义
我应该用 YES 和 NO 而不是 ON 和 OFF 自定义 UISwitch,我该怎么办?我不知道制作它的代码。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档没有显示用于更改 UISwitch 样式的属性,我一直实现此类功能的方式是使用 UISlider,并且您只能通过代码设置属性(至少是高级属性)。对于“是”和“否”,您可以将图像设置为滑块的左侧和右侧,对于过渡效果,您可以使用普通的动画功能,
我不知道我头顶上的属性,所以您将不得不尝试使用它,它可能是 UISlider.layer.property,因此一旦您输入第二个
.
,就会出现一个列表,您可以滚动该列表以查找与您要查找的内容相匹配的内容,但不要引用我的话,我对此不太确定。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
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.