对于iPhone 6和6+我使用以下代码在全屏幕上拉伸相机。 我基本上使用cameraViewTransform将相机拉伸到全屏。因此,与预览模式相比,我获得了更大的放大图像。我怎样才能仅捕获在预览模式下可见的那部分。
请参阅以下屏幕截图以获得更多清关
在Iphone 6中 - (在预览模式下)
(拍摄的图像)
在iphone 5中 - (在预览模式下)
(拍摄的图像)
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
// set the aspect ratio of the camera
float heightRatio = 4.0f / 3.0f;
// calculate the height of the camera based on the screen width
float cameraHeight = screenSize.width * heightRatio;
// calculate the ratio that the camera height needs to be scaled by
float scale = screenSize.height / cameraHeight;
// move the controller to the center of the screen
self.imagePickerController.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenSize.height - cameraHeight) / 2.0);
// concatenate the scale transform
self.imagePickerController.cameraViewTransform = CGAffineTransformScale(self.imagePickerController.cameraViewTransform, scale, scale);