ios - 回到原来的位置 UIImageView

标签 ios objective-c animation uiimageview rotation

我现在正在为 iOS 设备 实现一个 app,所以在 objective C 中,我在问如何保持原点在旋转之后定位 UIImageView ?

例如,我这样使用我的 UIImageView :

CGAffineTransform initialPosition = CGAffineTransformMakeRotation(0);
CGAffineTransform finalPosition = CGAffineTransformMakeRotation(M_PI/2);
[UIView beginAnimations: @"Rotate animation" context: NULL];
MySuperUIImageView.transform = initialPosition;
[UIView setAnimationDuration:1.0];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationRepeatCount:1];
[UIView setAnimationDelegate:self];
MySuperUIImageView.transform = finalPosition;
[UIView commitAnimations];

但之后,我让它消失了一段时间,使用:

MySuperUIImageView.alpha = 0.0f;

当我再次使用它时,我希望它处于第一个原始位置,没有旋转。容易吗?

提前致谢!

最佳答案

是的。很容易:

MySuperUIImageView.transform = CGAffineTransformIdentity;

关于ios - 回到原来的位置 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18550901/

相关文章:

javascript - 为其他幻灯片保留初始动画

javascript - 使用 css 链接复选框动画

ios - 单个 UICollectionViewController 中的多个自定义单元格,通过 NavigationBarButton 在之间循环

objective-c - 在数组中搜索最接近的浮点值

ios - Objective-C RabbitMQ 客户端不发布消息到队列

ios - NSMutableDictionary 没有写入文件

ios - 没有 Storyboard ,UICollectionView 无法工作

ios - 使用 OpenGL ES 2.0 着色器的平滑纹理线

ios - 使用带有来自设备的 avfoundation 的 swift 将 Capture session 保存在文档目录中

python - matplotlib 动画 FuncAnimation 帧参数