iOS 4.2:使用块动画翻转图像 [英] iOS 4.2: Flip image using block animations

查看:96
本文介绍了iOS 4.2:使用块动画翻转图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有这段代码:

I had this piece of code im my app:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:imgView cache:YES];
    imgView.image = img2;
[UIView commitAnimations];

但是在iOS 4.0及更高版本中不鼓励使用此方法,我应该使用 transitionWithView:duration:options:animations:completion:

But use of this method is discouraged in iOS 4.0 and later, and I should use transitionWithView:duration:options:animations:completion:

我无法正常工作。谁能帮我?
Thx!

I cant get this to work properly. Can anyone help me? Thx!

推荐答案

[UIView transitionWithView:imgView    // use the forView: argument
                  duration:1          // use the setAnimationDuration: argument
                   options:UIViewAnimationOptionTransitionFlipFromLeft 
                          // check UIViewAnimationOptions for what options you can use
                animations:^{         // put the animation block here
                              imgView.image = img2;
                           }
                completion:NULL];     // nothing to do after animation ends.

这篇关于iOS 4.2:使用块动画翻转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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