问题描述
我已经创建了一个自定义 UI 并将其分配给 UIImagePickerController 的相机叠加层,如下所示。
自定义视图
cameraOverlay = RecordView.loadNib()
cameraOverlay.frame = UIScreen.main.bounds
cameraOverlay.buttonStartRecording.addTarget(self,action: #selector(buttonStartStopRecordingClicked),for: .touchUpInside)
cameraOverlay.buttonCancel.addTarget(self,action: #selector(buttonCancelClicked),for: .touchUpInside)
cameraOverlay.buttonSwitchCamera.addTarget(self,action: #selector(buttonCameraSwitchClicked),for: .touchUpInside)
cameraOverlay.buttonFlash.addTarget(self,action: #selector(buttonFlashClicked),for: .touchUpInside)
cameraOverlay.labelTimer.text = "00:00/\(self.secondsToHoursMinutesSeconds(inputSeconds: recordingTimeLimit))"
图像选择器控制器
imagePicker.delegate = self
imagePicker.sourceType = .camera
imagePicker.mediaTypes = [kUTTypeMovie as String]
imagePicker.allowsEditing = true
imagePicker.cameraOverlayView = cameraOverlay
imagePicker.showsCameraControls = false
imagePicker.cameraFlashMode = .off
imagePicker.cameraCaptureMode = .video
imagePicker.cameraDevice = .rear
self.present(imagePicker,animated: true,completion: nil)
这适用于没有缺口的相机,但在 iPhone X 及更高版本上,UI 从缺口后面的顶部被切掉。我不知何故需要在安全区域内设置我的自定义叠加层,但不确定如何做到这一点。请有人可以帮助我。提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)