OGeek|极客世界-中国程序员成长平台

标题: ios - UIImageView.animationImages 显示带有旋转的图像 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 00:04
标题: ios - UIImageView.animationImages 显示带有旋转的图像

我有一个 UIImageView,它应该为名为 capturedImages 的图像数组设置动画。我的动画设置如下:

imageView = [[UIImageView alloc] init];
imageView.frame = CGRectMake(0, 48, 320, 520);
imageView.animationImages = capturedImages;


imageView.animationDuration = 3.0;
imageView.animationRepeatCount = 0; //animate forever
[imageView startAnimating];

[self.view addSubview:imageView];

captureImages 中的图像是在手机/相机 View 直立的情况下拍摄的。但是,当 imageView 显示它们时,它们会正确设置动画,但会逆时针旋转 90 度。有没有办法改变 animationImages 的方向,还是我必须单独设置每个图像的方向?



Best Answer-推荐答案


最简单的解决方案可能是只旋转 UIImageView 本身。
您可以使用 UIViewtransform 属性来执行此操作:

[imageView setTransform:CGAffineTransformMakeRotation(M_PI_2)];

请注意,如果您开始显示已经处于正确方向的图像,这将中断。这些也会顺时针旋转 90 度。

关于ios - UIImageView.animationImages 显示带有旋转的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24943024/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4