【发布时间】:2016-08-24 01:19:59
【问题描述】:
我想这样设置我的 Switch:
但我尝试在 ios9 中,它不起作用。 我在苹果 UISwitch 类参考中看到了。 它说:
讨论 在 iOS 7 中,此属性无效。
iOS 9 怎么样?有没有成功的?
我的代码:
switch1 = UISwitch(frame:CGRectMake(self.view.frame.width/2 - 20, 400, 10, 100))
switch1.on = true
switch1.onTintColor = UIColor.lightGrayColor()
switch1.tintColor = UIColor.greenColor()
switch1.thumbTintColor = UIColor.blackColor()
//设置开/关图像
switch1.onImage = UIImage(named: "on-switch")
switch1.offImage = UIImage(named: "off-switch")
【问题讨论】: