Programmatically zoom in and out in iPhone: how ca

2019-06-19 03:27发布

问题:

I have an app where i would like to dynamically zoom in and out an imageView.

I use [scrollView zoomToRect:CGRectMake(x,y,z,k) animated:YES]; to zoom in but i would like the animation to be slower ... is there a way to set the animation speed?

回答1:

see my other answer. You can set the animation duration to something like 1.0 second.

instead of:
cursorView.center = locationOfTouch;

you have to set:

[UIView beginAnimations:nil context:NULL]
[UIView setAnimationDuration:1.0];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];

[scrollView zoomToRect:CGRectMake(x,y,z,k) animated:NO]; // NO is necessary!

[UIView commitAnimations];