扫码关注官方订阅号
这是正对着键盘拍的,画面翻转了90°,怎样可以想竖屏时正常显示?
ringa_lee
你可以看一下有关 UIImage imageOrientation 属性的文档。网上也有很多修正 orientation 的代码。
下面这样
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(); // 调整图片角度完毕 }
楼主,这个问题解决了吗???求答案
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
你可以看一下有关 UIImage imageOrientation 属性的文档。网上也有很多修正 orientation 的代码。
下面这样
楼主,这个问题解决了吗???求答案