ios - ELCImagePickerController 不会 swift 返回到 viewController

标签 ios objective-c swift elcimagepickercontroller

我使用ELCImagePickerController 选择多张照片。但是,当我选择照片并单击“完成”按钮时,它会返回选择相册页面。请帮助我,所以当我选择照片时它应该返回 viewController

这是我使用的代码:

var picker = ELCImagePickerController(imagePicker: ())
 @IBAction func ButtonIsclick(sender: AnyObject) {
    picker.delegate = self

    self.presentViewController(picker, animated: true, completion: nil)
}

func elcImagePickerController(picker: ELCImagePickerController!, didFinishPickingMediaWithInfo info:[AnyObject]!) {
    self.dismissViewControllerAnimated(true, completion: nil)
}

func elcImagePickerControllerDidCancel(picker: ELCImagePickerController!){
    self.dismissViewControllerAnimated(true, completion: nil)
}

编辑:当我调试代码时,它从不调用didFinishPickingMediaWithInfo 函数

最佳答案

实际上我遇到这个问题是因为错误地设置了delegate

在我的问题中,我将 delegate 设置为

picker.delegate = self

这是错误的。正确的做法是设置ELCImagepickerDelegate

 picker.imagePickerDelegate = self

关于ios - ELCImagePickerController 不会 swift 返回到 viewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30883871/

相关文章:

ios - 核心数据合并政策

ios - 无法导入 Alamofire

objective-c - 属性的参数数量错误

ios - Swift:如何从 subview Controller prepareForSegue传递数据来更改父 View Controller TableView 单元格的TextLabel?

objective-c - 如何确定应用程序何时变为事件状态和非事件状态?

iphone - 如何在以编程方式创建的 UILabel 上添加 padding-left?

swift - 从实体中删除属性后迁移 CoreData 时出错

ios - Xcode:当应用程序在后台运行时间超过 5 分钟时,转到 Storyboard 中的第一页?

ios - 在SwiftUI中手动设置亮/暗模式并保存用户选择

ios - 手势结束后,实例变量将重置为零