tou*_*bun 5 camera uitabbarcontroller uiimagepickercontroller ios swift
我正在介绍UIImagePickerController一个UITabBarController.
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.allowsEditing = false
imagePicker.showsCameraControls = false
presentViewController(imagePicker, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我明确设置showsCameraControls为false将我的自定义叠加视图放在相机顶部.但为什么底部有黑色空间?有什么帮助?

Leo*_*Leo 10
相机宽高比为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);
Run Code Online (Sandbox Code Playgroud)
屏幕截图

目标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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1036 次 |
| 最近记录: |