使用iOS 8的UIImagePickerController cameraViewTransform没有缩放 [英] UIImagePickerController using iOS 8 cameraViewTransform isn't scaling
问题描述
我之前解决了相机叠加问题:喜欢这个
I have previously solved a camera overlay issue: like this
CGSize screenBounds = [UIScreen mainScreen].bounds.size;
CGFloat cameraAspectRatio = 4.0f/3.0f;
CGFloat camViewHeight = screenBounds.width * cameraAspectRatio;
CGFloat scale = screenBounds.height / camViewHeight;
self.picker.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenBounds.height - camViewHeight) / 2.0);
self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, scale, scale);
但现在在iOS 8中,实时照片预览的底部再次出现黑条。因此这样的缩放不再有效:
but now in iOS 8 there's a black bar a the bottom of the live photo preview again. so scaling like this no longer works:
self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, scale, scale);
我无法缩放cameraViewTransform。有关如何使用iOS 8的任何想法?这是否被弃用?
I'm not able to scale the cameraViewTransform. Any ideas on how to get this to work with iOS 8? Has this been deprecated?
推荐答案
在iOS 8中,如果要填充屏幕,则不再需要缩放。因此,您要做的独特之处是评论作业:
In iOS 8 you no longer need to scale if you want to fill the screen. So the unique thing you have to do is to comment the assignment:
// self.picker.cameraViewTransform
//self.picker.cameraViewTransform
也就是说,self.picker.cameraViewTransform = CGAffineTransformMakeScale(1.0,1.0)会自动符合self.picker.view.frame。
That is to say, self.picker.cameraViewTransform = CGAffineTransformMakeScale(1.0, 1.0) conforms to self.picker.view.frame automatically.
总之,工作是已由UIImagePickerController为您完成。
In conclusion, the work is already done for you by UIImagePickerController.
这篇关于使用iOS 8的UIImagePickerController cameraViewTransform没有缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!