ios - Swift CGAffineTransformScale to a scale, not by a scale -


let's scale uilabel using cgaffinetransformscale so:

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 want scale uilabel half. if call same code again, end scale of 0.25, scales again half.

would possible use cgaffinetransformscale scale size of half original uilabel frame, instead of scaling cumulatively?

swift 3:

text.transform = cgaffinetransform.identity uiview.animate(withduration: 0.25, animations: {    self.text.transform = cgaffinetransform(scalex: scale, y: scale) }) 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -