是否有可能从UIImageOrientation中删除或完全删除UIImage信息?
我可以把image.imageOrientation = nil设置为零吗?
我想在身体上旋转我的图像,并剥夺方向。
发布于 2014-05-06 18:08:33
您不能将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);https://stackoverflow.com/questions/23501698
复制相似问题