旋转UIImage?

问题描述:

您是否可以在不使用换算关系UIImageView的情况下旋转UIImage。我正在使用UIImage作为地图上的自定义别针,如果可能,我想旋转它?旋转UIImage?

编号可能能够做的唯一的事情就是设置UIImageOrientation以使操作系统在您的基础上为您旋转 - 尽管这只会给您四个(主)90-度旋转。

+0

但是UIImage :: imageOrientation是只读的! – Martin 2012-07-13 10:17:50

耶士可以在预定义的ImageOrientations旋转和的UIImage:

的UIImage * rotatedImage = [UIImage的imageWithCGImage:imageObject.CGImage规模:imageObject.scale取向:UIImageOrientationUp];

这里取向是预定义枚举变量:

UIImageOrientationUp, 
UIImageOrientationUpMirrored 
UIImageOrientationDown 
UIImageOrientationDownMirrored 
UIImageOrientationLeft 
UIImageOrientationRight etc 

它旋转的UIImage。