/// 设置UISwitch 未选中颜色, 支持缩放后正确展示
/// @param sw sw
/// @param color 关闭状态颜色
- (void)kSetSwitchOffTintColor:(UISwitch *)sw offTintColor:(UIColor *)color{
NSArray * arr1 = sw.subviews;
if (arr1.count > 0) {
UIView * view1 = arr1[0];
NSArray * arr2 = view1.subviews;
if (arr2.count > 0) {
UIView * view2 = arr2.firstObject;
view2.backgroundColor = color;
}
}
}
close.png
open.png
网友评论