Programmatically zoom in and out in iPhone: how ca

2019-06-19 02:58发布

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条回答
再贱就再见
2楼-- · 2019-06-19 03:30

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];
查看更多
登录 后发表回答