I'd like to animate scaling a UIView and all of its content in a non blocking way. Currently I do this ...
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.1];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
CGAffineTransform transform = CGAffineTransformMakeScale(1.1,1.1);
self.view.transform = transform;
[UIView commitAnimations];
However it is blocking. I would rather use something like ...
[UIView animateWithDuration:0.2
animations:^{
CGAffineTransform transform = CGAffineTransformMakeScale(1.1,1.1);
self.view.transform = transform;
}];
... but animateWithDuration doesn't to work with CALayer/CGAffineTransform transformation. How can I achieve the same animation without blocking anything?
try using:
[UIView animateWithDuration:0.2
animations:^{
CGAffineTransform transform =
CGAffineTransformScale(CGAffineTransformIdentity, 2.0, 2.0);
self.view.transform = transform;
}];
Just adding a useful note to this great answer, almost always you want to turn on rasterisation, so it looks smooth
self.view.layer.shouldRasterize = YES;
[UIView animateWithDuration:0.2
animations:^{
CGAffineTransform transform =
CGAffineTransformScale(CGAffineTransformIdentity, 0.5, 0.5);
self.view.transform = transform;
}];