views:

41

answers:

1

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?

A: 

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];
Eiko
This helps to do animations, but what I really want is resetting the frame after being transformed many times, so that it fits the window directly. I can't use a scrollview with an imageview because I need to register some UITouches which scrollview takes and does not share with its subviews.
hakewake
Dou you want pulsing effect, or why do you use many transformations? Normally only this code is needed - or something similar. Maybe describe what your starting with and what you'd like to accomplish. You can also set a callback when the animation finishes.
Eiko