是否可以剥离或完全删除 UIImageOrientation
来自 UIImage 的信息?
可以设置image.imageOrientation = nil
还是一无所有?
我想物理旋转我的图像并剥离方向。
最佳答案
您不能将 imageOrientation 设置为零,因为它不是对象。你可以在 UIImage 头定义文件中找到它,你会发现它被定义为一个 NSInteger
typedef NS_ENUM(NSInteger, UIImageOrientation)
除了作为 NSInteger 之外,与之关联的属性是只读的,这意味着您不能直接通过 setter 方法更改它:
@property(nonatomic,readonly) UIImageOrientation imageOrientation;
UIImageOrientationUp 是 UIImage 的默认方向,您可以做的是创建一个具有您想要使用/喜欢的方向的新图像,例如:
+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(4_0);
关于ios - 是否可以从 UIImage 中剥离或完全删除 UIImageOrientation 信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23501698/