在imageview中图像的方向在设备中左移90左右
问题描述:
我从imagepickercontroller中选择图像,并在imageview中进行双击,但对于从相机拍摄的图像,它们总是出现在设备左侧90.对于我在模拟器他们有正确的方向如何纠正this.should我指定任何方向的图像在imageview中图像的方向在设备中左移90左右
答
我碰到了同样的问题,我自己。我解决这个问题的方法是检查图像的方向,然后旋转它,如果它应该是风景。
我使用的代码是:
float orientation = [[myPhotoAsset valueForProperty:@"ALAssetPropertyOrientation"] floatValue];
if (orientation == 3)
photo = [self CGImageRotatedByAngle:photo angle:-90];
干杯
+0
但我没有使用alassets frmwrk.i使用uiimagepickercontroller。 – sujith1406 2011-04-01 10:04:02
答
我有同样的问题,但最后我用下面的代码解决了这个问题:
的UIImage *图像= [UIImage的imageWithCGImage: [asset defaultRepresentation] fullScreenImage]];
请尝试以下链接中的代码。 http://stackoverflow.com/questions/538041/uiimagepickercontroller-camera-preview-is-portrait-in-landscape-app/538064#538064 – EmptyStack 2011-03-31 13:24:48
感谢您的link.this解决了我的问题。 – sujith1406 2011-04-01 10:04:42