摄像头下方有黑底space
There is a black bottom space below the camera
我正在展示来自 UITabBarController
的 UIImagePickerController
。
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.allowsEditing = false
imagePicker.showsCameraControls = false
presentViewController(imagePicker, animated: true, completion: nil)
我已明确将 showsCameraControls
设置为 false 以将我的自定义叠加视图置于 camera.But 之上 为什么底部有黑色 space?有帮助吗?
相机宽高比为4:3,您必须应用变换比例才能获得全屏
Swift
let screenSize = UIScreen.mainScreen().bounds.size
let aspectRatio:CGFloat = 4.0/3.0
let scale = screenSize.height/screenSize.width * aspectRatio
self.imagePikerViewController.cameraViewTransform = CGAffineTransformMakeScale(scale, scale);
屏幕截图
Objective C
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
float aspectRatio = 4.0/3.0;
float scale = screenSize.height/screenSize.width * aspectRatio;
self.imagePikerViewController.cameraViewTransform = CGAffineTransformMakeScale(scale, scale);
我正在展示来自 UITabBarController
的 UIImagePickerController
。
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.allowsEditing = false
imagePicker.showsCameraControls = false
presentViewController(imagePicker, animated: true, completion: nil)
我已明确将 showsCameraControls
设置为 false 以将我的自定义叠加视图置于 camera.But 之上 为什么底部有黑色 space?有帮助吗?
相机宽高比为4:3,您必须应用变换比例才能获得全屏
Swift
let screenSize = UIScreen.mainScreen().bounds.size
let aspectRatio:CGFloat = 4.0/3.0
let scale = screenSize.height/screenSize.width * aspectRatio
self.imagePikerViewController.cameraViewTransform = CGAffineTransformMakeScale(scale, scale);
屏幕截图
Objective C
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
float aspectRatio = 4.0/3.0;
float scale = screenSize.height/screenSize.width * aspectRatio;
self.imagePikerViewController.cameraViewTransform = CGAffineTransformMakeScale(scale, scale);