使用iOS 8的UIImagePickerController cameraViewTransform不是缩放

时间:2014-09-09 00:17:11

标签: ios objective-c ios8

我之前解决过相机覆盖问题: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中,黑色条再次成为实时照片预览的底部。所以这样的缩放不再有效:

self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, scale, scale);

我无法缩放cameraViewTransform。有关如何使用iOS 8的任何想法?这是否被弃用了?

1 个答案:

答案 0 :(得分:0)

在iOS 8中,如果要填充屏幕,则不再需要缩放。因此,您必须做的独特之处是评论作业:

// self.picker.cameraViewTransform

也就是说,self.picker.cameraViewTransform = CGAffineTransformMakeScale(1.0,1.0)会自动符合self.picker.view.frame。

总之,UIImagePickerController已经完成了这项工作。