如何设置UISwitch边框颜色?
我的应用已经完成:
[[UIView appearance] setTintColor:[UIColor whiteColor]];
这就是我所拥有的:
和off
:
我需要使UISwitch
边框像在Settings.app中一样可见:
你的[[UIView appearance] setTintColor:[UIColor whiteColor]];
干扰你的开关的色调。 设置色调的命令是self.mySwitch.tintColor = [UIColor grayColor];
它设置用于在closures时为开关的轮廓着色的颜色。
你可以尝试添加这行到你的AppDelegate的didFinishLaunchingWithOptions
[[UISwitch appearance] setTintColor:[UIColor grayColor]];
这应该在你所有的UISwitch控件上应用所选的Tint颜色。
而不是使用外观代理,你也可以使用:
[self.mySwitch setThumbTintColor:[UIColor blueColor]]; [self.mySwitch setOnTintColor:[UIColor redColor]];
即。 使用setOnTintColor作为背景/边框颜色。