iOS 自定义UISwitch OC Swift

//OC版

-(void)awakeFromNib{

[superawakeFromNib];

self.transform=CGAffineTransformMakeScale(0.5,0.5);

self.layer.anchorPoint=CGPointMake(0,0.5);

}

//Swift版

classSwitchButton:UISwitch{

overridefuncawakeFromNib() {

transform=CGAffineTransformMakeScale(0.5,0.5)

layer.anchorPoint=CGPoint(x:0, y:0.3)

}}

iOS 自定义UISwitch OC Swift_第1张图片

你可能感兴趣的:(iOS 自定义UISwitch OC Swift)