// 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)
}}
网友评论