美文网首页
解决拍照自动旋转90度问题

解决拍照自动旋转90度问题

作者: warm_iOS | 来源:发表于2019-08-15 14:30 被阅读0次
    #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];
    

    相关文章

      网友评论

          本文标题:解决拍照自动旋转90度问题

          本文链接:https://www.haomeiwen.com/subject/wwdzjctx.html