以编程方式在iPhone中放大和缩小:如何设置动画速度? [英] Programmatically zoom in and out in iPhone: how can i set animation speed?

查看:123
本文介绍了以编程方式在iPhone中放大和缩小:如何设置动画速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个想要动态放大和缩小imageView的应用程序.

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

我使用 [scrollView zoomToRect:CGRectMake(x,y,z,k)animation:YES]; 进行放大,但我希望动画变慢...有没有办法设置动画速度?

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.0 秒.

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

代替:
cursorView.center = locationOfTouch;

您必须设置:

[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];

这篇关于以编程方式在iPhone中放大和缩小:如何设置动画速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆