iOS 关于拍照照片旋转问题

2018-04-18  本文已影响25人  Luyc_Han
#pragma mark----解决图片自动旋转问题
- (UIImage *)normalizedImage:(UIImage *)image{
    if (image.imageOrientation == UIImageOrientationUp){
        return image;
    }
    
    UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
    [image drawInRect:(CGRect){0, 0, image.size}];
    UIImage *normalizedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return normalizedImage;
}

使用

UIImage *currentImage = [self normalizedImage:currentImage];
上一篇下一篇

猜你喜欢

热点阅读