Let's say I scale a UILabel using a CGAffineTransformScale, for example:
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")
})
This works great when I want to scale UILabel by half. But if I dialed the same code again, it would have got a scale of 0.25, since it scales again by half.
Is it possible to use CGAffineTransformScale to always scale to half the size of the original UILabel frame, rather than scale it cumulatively?
source
share