UISwitch修改大小的和关闭打开的颜色

UISwitch不能修改大小,只能设置缩放

        _swith.transform = CGAffineTransformMakeScale(0.8, 0.8);

tintColor设置这个颜色,只是对外观进行设置,但是里面的背景色不起作用

        _swith.onTintColor = UIColorMakeWithHex(@"#F54440");
        _swith.tintColor =  UIColorMakeWithHex(@"#EBEBEB");
        _swith.backgroundColor =  UIColorMakeWithHex(@"#EBEBEB");
        _swith.layer.cornerRadius = 15;
        _swith.layer.masksToBounds = YES;
        _swith.transform = CGAffineTransformMakeScale(0.8, 0.8);

你可能感兴趣的:(UISwitch修改大小的和关闭打开的颜色)