旋转UIImage?

5

您是否可以在不使用UIImageView上的变换的情况下旋转UIImage?我正在将UIImage用作地图上的自定义图钉,如果可能的话,希望能够旋转它。

2个回答

3
不行。你唯一可能做的事情是将UIImageOrientation设置为与操作系统匹配,以便在此基础上为您旋转 - 尽管这只会给您四个(主要的)90度旋转。

0

是的,您可以在预定义的图像方向中旋转UIImage:

UIImage *rotatedImage = [UIImage imageWithCGImage:imageObject.CGImage scale:imageObject.scale orientation:UIImageOrientationUp];

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

UIImageOrientationUp,
UIImageOrientationUpMirrored
UIImageOrientationDown
UIImageOrientationDownMirrored
UIImageOrientationLeft
UIImageOrientationRight    etc

它可以旋转UIImage。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接