假设我使用 CGAffineTransformScale 缩放 UILabel,如下所示:
let scale = 0.5
text = UILabel(frame: CGRectMake(100, 100, 100, 100))
text.text = "Test"
UIView.animateWithDuration(2.0, delay: 0.0, options: UIViewAnimationOptions.CurveEaseIn, animations: {
self.text.transform = CGAffineTransformScale(self.text.transform, scale, scale)
}, completion: {(value : Bool) in
print("Animation finished")
})
当我想将 UILabel 缩放一半时,这很有效。但是,如果我再次调用相同的代码,它会以 0.25 的比例结束,因为它再次缩放一半。
是否可以使用 CGAffineTransformScale 始终缩放到原始 UILabel 框架的一半大小,而不是累积缩放?