在“关闭”状态下更改UISwitch的颜色州 [英] Change color of UISwitch in "off" state

查看:261
本文介绍了在“关闭”状态下更改UISwitch的颜色州的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到我们可以将UISwitch按钮的外观更改为on状态,
但是是否也可以在关闭状态下更改UISwitch的颜色?

I've learned that we can change the UISwitch button appearance in its "on" state, but is it also possible to change the color of the UISwitch in the "off" state?

推荐答案

尝试使用此

yourSwitch.backgroundColor = [UIColor whiteColor];
youSwitch.layer.cornerRadius = 16.0;

感谢@Barry Wyckoff。

All thanks to @Barry Wyckoff.

这篇关于在“关闭”状态下更改UISwitch的颜色州的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆