2014-11-22 87 views
0

我正在使用SevenSwitch控件而不是内置的UISwitch。我希望双方都拥有相同的背景颜色,而不是开启和关闭模式。iOS 8中的SevenSwitch UI背景颜色

我尝试下面的代码:

let mySwitch = SevenSwitch() 
let switchTintColor = UIColor(red: 109/255, green: 59/255, blue: 100/255, alpha: 1.0) 
mySwitch.offLabel.backgroundColor = switchTintColor 
mySwitch.onTintColor = switchTintColor 
mySwitch.borderColor = switchTintColor 

这变得非常接近我想要的东西,除了拇指视图后面的背景,当开关处于关闭状态。

Example

回答

1

你要设置的交换机上的activeColorinactiveColor性能。这应该让你知道你在做什么。

mySwitch.activeColor = switchTintColor 
mySwitch.inactiveColor = switchTintColor 
+0

明白了。谢谢! – davidethell 2014-11-24 11:01:14