[英]UIImagePickerController with timelapse/slowmo in iOS8
[英]UIImagePickerController iOS8 issue
问题出在iPhone6(iOS 8.1和iOS 8.1.1)和UIImagePickerController上
我使用代码:
self.imagePickerController = [[UIImagePickerController alloc] init];
[self.imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
self.imagePickerController.showsCameraControls = NO;
self.imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
self.imagePickerController.view.layer.borderWidth = 2;
self.imagePickerController.view.layer.borderColor = [UIColor redColor].CGColor;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
但是在那之后,在iPhone6上我看到了没有底部的相机视图(在iPhone4s iOS 8.1上一切正常):
图像的顶部具有4:3的比例,要使相机以全屏显示,您可以执行以下操作。
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.