我正在接收我UIImage
的 'sAVCaptureSession
并将它们设置为UIImageView
's。纵向模式将图像设置为正确的方向,但是一旦我使用横向模式,图像就会顺时针旋转 90 度。
我做了一些研究,发现我可以使用UIImageOrientation
这种方法来解决我的问题:
[UIImage imageWithCGImage:cgimageref scale:1 orientation:orientation]
但我不明白怎么做。如果我查看UIImageOrientation
所有图像,纵向和横向模式下的值始终为 3 ( NSLog(@"%d",UIImageOrientation)
)。我很困惑这对我有什么帮助。我错过了什么吗?
这是方向代码:
-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
self.prevLayer.frame = self.view.bounds;
self.prevLayer.orientation = [[UIDevice currentDevice] orientation];
}
shouldAutorotateToInterfaceOrientation 返回 YES。