ios - 扫描二维码,调用摄像头,横屏拍到的画面会有90度的旋转
ringa_lee
ringa_lee 2017-04-17 17:45:40
0
3
760

这是正对着键盘拍的,画面翻转了90°,怎样可以想竖屏时正常显示?

ringa_lee
ringa_lee

ringa_lee

reply all(3)
左手右手慢动作

You can take a look at the documentation about UIImage imageOrientation property. There are also many codes for correcting orientation on the Internet.

刘奇

Like this

UIImage* image=[info objectForKey:UIImagePickerControllerOriginalImage];  
        UIImageOrientation imageOrientation=image.imageOrientation;  
        if(imageOrientation!=UIImageOrientationUp)  
        {  
            // 原始图片可以根据照相时的角度来显示,但UIImage无法判定,于是出现获取的图片会向左转90度的现象。  
            // 以下为调整图片角度的部分  
            UIGraphicsBeginImageContext(image.size);  
            [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];  
            image = UIGraphicsGetImageFromCurrentImageContext();  
            UIGraphicsEndImageContext();  
            // 调整图片角度完毕  
        } 
洪涛

Owner, has this problem been solved? ? ? Looking for answers

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template