// 这里是用的是生成图片时的设备方向,如果需要按照拍照时的设备方向,可以在capureOutput:willCapturePhotoForResolvedSettings:中保存 UIImageOrientation takeImageCompletion:tempImage buffer:nil error:error]; } } // 这个方法可以放在UIDeviceOrientation的Category中统一定义 - (UIImageOrientation
这里随便从网上找了一个,需要的可以参考下 基础知识 首先我们需要知道每一个UIImage对象,都有一个imageOrientation属性,里面保存着方向信息: typedef NS_ENUM(NSInteger, UIImageOrientation ,主要用到了下面的这个方法: - (instancetype)initWithCIImage:(CIImage *)ciImage scale:(CGFloat)scale orientation:(UIImageOrientation
(gifDataSource, i, nil) let image:UIImage =UIImage(cgImage:scale:UIScreen.main.scale,orientation:UIImageOrientation.up public init(CGImage cgImage: CGImage, scale: CGFloat, orientation: UIImageOrientation) 通过上述两步已经获取了UIImage ,scale:UIScreen.main.scale,orientation:UIImageOrientation.up ) 9 let imageData:Data = UIImagePNGRepresentation
important;">typedef NS_ENUM(NSInteger, UIImageOrientation) { UIImageOrientationUp, // default orientation
button.transform = rotationTransform; 最后,作为accessoryView使用按钮: cell.accessoryView = button; 2.2.15.2 方案二UIImageOrientation UIControlStateNormal]; [cell addSubview: btn]; #pragma mark - 图片旋转 - (UIImage*) changeImageOrientation: (UIImageOrientation
requestImageDataForAsset:asset options:option resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation
sd_imageWithWebPData:data]; } #endif else { image = [[UIImage alloc] initWithData:data]; UIImageOrientation
else {// 3.其他情况 image = [[UIImage alloc] initWithData:data]; // 获取图片的方向 UIImageOrientation
获取旋转角度的图片 -(UIImage *)dw_RotateImageWithAngle:(CGFloat)angle; ///按给定的方向旋转图片 -(UIImage*)dw_RotateWithOrient:(UIImageOrientation
sd_imageWithWebPData: data]; } #endif else { image =[[UIImage alloc] initWithData: data]; UIImageOrientation
UIImage *)scaledImageWithData:(NSData *)data withSize:(CGSize)size scale:(CGFloat)scale orientation:(UIImageOrientation