gpt4 book ai didi

ios - 如何告诉我的 imagePickerController 委托(delegate)我的自定义 UIButton 正在处理拍照

转载 作者:行者123 更新时间:2023-11-30 14:00:31 26 4
gpt4 key购买 nike

如何指示 imagepickercontroller 委托(delegate)允许我的自定义 UIButton 拍照,然后将其存储在 didFinishPickingImage 委托(delegate)方法中的 imageView 文件中?非常感谢您的帮助。

 @IBAction func takePicture(sender: AnyObject) {   
imagePicker.takePicture()
}

override func viewDidAppear(animated: Bool) {
overlayView.opaque = true
overlayView.backgroundColor = UIColor.clearColor()

imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
imagePicker.delegate = self
imagePicker.showsCameraControls = false
imagePicker.allowsEditing = true
imagePicker.cameraOverlayView = overlayView

self.presentViewController(imagePicker, animated: false, completion: nil)
}

最佳答案

您需要实现 didFinishPickingMediaWithInfo:委托(delegate)。当您使用自定义捕获按钮拍照时,将调用此委托(delegate)方法。

func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : AnyObject])
{
let image: UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage;
yourImageView.image = image;
}

关于ios - 如何告诉我的 imagePickerController 委托(delegate)我的自定义 UIButton 正在处理拍照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33055986/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com