问题
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);
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);
I'm not able to scale the cameraViewTransform. Any ideas on how to get this to work with iOS 8? Has this been deprecated?
回答1:
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
That is to say, self.picker.cameraViewTransform = CGAffineTransformMakeScale(1.0, 1.0) conforms to self.picker.view.frame automatically.
In conclusion, the work is already done for you by UIImagePickerController.
来源:https://stackoverflow.com/questions/25734962/uiimagepickercontroller-using-ios-8-cameraviewtransform-isnt-scaling