2014-11-22 85 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