iphone - 如何在 iphone 应用程序中实现图像翻转动画

标签 iphone ios animation

如何实现图像向右翻转动画。下面给出的代码。请帮忙。

imageview.animationImages=[NSArray arrayWithObjects:  
   [UIImage imageNamed:@"image1.png"],
   [UIImage imageNamed:@"imag2.png"],
   [UIImage imageNamed:@"imag3.png"],
   [UIImage imageNamed:@"imag4.png"],
   [UIImage imageNamed:@"imag5.png"], 
   [UIImage imageNamed:@"imag6.png"],
   [UIImage imageNamed:@"imag7.png"], nil];

imageview.animationDuration=15.0;
imageview.animationRepeatCount=0;
[imageview startAnimating];

最佳答案

垂直翻转

[UIView animateWithDuration:1.0 animations:^{
    yourView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0,0.0);
} completion:^(BOOL finished){
    // code to be executed when flip is completed
}];

水平翻转

[UIView animateWithDuration:1.0 animations:^{
    yourView.layer.transform = CATransform3DMakeRotation(M_PI,0.0,1.0,0.0);
} completion:^(BOOL finished){
    // code to be executed when flip is completed
}];

并且不要忘记将 QuartzCore 框架添加到项目中并导入

#import <QuartzCore/QuartzCore.h>

关于iphone - 如何在 iphone 应用程序中实现图像翻转动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13716214/

相关文章:

android - 如何在指定时间段内将图像从底部移动到顶部?

ios - 使用 SnapKit 约束动画

iphone - 即使 UITextField 为空,我也能检测到删除键吗?

ios - 有什么方法可以禁用钱包通行证和 Android 支付中的共享通行证按钮吗?

ios - 在出现String-Hack之后重新签名MobileSubstrate-dylib?

ios - 启用解析本地数据存储和 PFQueryTableViewController 问题

ios - 此 mac 上未安装用于分发的私钥

ios - iOS 中的 GPUImage 二值化

ios - SWIFT UITableView - 原型(prototype)单元格中的多行转至另一个 UITableView

css 动画只在第一次工作