我的代码在拍照时会在 imagePicker 的顶部显示一条红线。我想做同样的事情,但在红线中间添加一个图像。见图。我在黄色框中添加了单词 image 作为我尝试编码的示例。
@IBAction func takePhoto(_ sender: UIButton) {
imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .camera
present(imagePicker, animated: true, completion: nil)
let mainView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height-150))
let blockView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: self.view.frame.size.width, height: 150))
blockView.backgroundColor = UIColor.red
mainView.addSubview(blockView)
imagePicker.cameraOverlayView = mainView
}