如何以编程方式设置的某个角度旋转图像? [英] How to rotate an image by some angle which is set by programmatically?
本文介绍了如何以编程方式设置的某个角度旋转图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,我正在从iPad图像库中获取随机图像,并将其显示在UIImageView中.我想将其旋转一些可以设置的预定义角度.
Currently I am fetching a random image from the iPad image library and showing it in UIImageView. I want to rotate it by some predefined angle which I can set.
我不希望任何基于触摸的旋转.我怎样才能做到这一点?
I don't want any touch based rotation. How can I do that?
推荐答案
为什么不只是旋转UIImageView? 包括QuartzCore框架.
Why not just rotate the UIImageView? Include QuartzCore framework.
#import <QuartzCore/QuartzCore.h>
self.imageView.layer.affineTransform = CGAffineTransformMakeRotation(angle)
请参阅 查看全文