Question

So I've used CGAffineTransform to zoom in,

CGAffineTransform newTrans2 = CGAffineTransformScale(mainView.transform,1.05,1.05);
mainView.transform = newTrans2;

I do this 15 times to have an animation effect.

Now I would like to zoom out such that mainView fits the iPhone frame (0,0,320,480).

Besides, the user is able to pinch in and pinch out, so I really wonder how I can zoom out and reset it in the original space.

How can I do this?

Was it helpful?

Solution

Just use UIView animation, which is simple yet effective. Configure it however you like:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[mainView setFrame:CGMakeRect(0,0,320,480)];
[UIView commitAnimations];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top