相机下方有一个黑色底部空间

我将从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以将我的自定义叠加视图放在相机顶部。但是为什么底部有黑色空间?有什么帮助吗?

在此处输入图像描述

相机宽高比为4:3,您必须应用变换比例才能全屏显示

迅速

 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); 

屏幕截图

目标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);