错误 -视图控制器不符合协议“ELCImagePickerControllerDelegate”,因为您必须实现以下 2 个强制的委托方法。(非可选)
func elcImagePickerController(picker: ELCImagePickerController!, didFinishPickingMediaWithInfo info: [AnyObject]!) {
}
func elcImagePickerControllerDidCancel(picker: ELCImagePickerController!) {
}
下载整个工作项目
工作代码
import UIKit
class ViewController: UIViewController, ELCImagePickerControllerDelegate {
var picker = ELCImagePickerController(imagePicker: ())
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool) {
picker.maximumImagesCount = 5
picker.imagePickerDelegate = self
self.presentViewController(picker, animated: true, completion: nil)
}
func elcImagePickerController(picker: ELCImagePickerController!, didFinishPickingMediaWithInfo info: [AnyObject]!) {
}
func elcImagePickerControllerDidCancel(picker: ELCImagePickerController!) {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
那个黑屏是因为
var picker = ELCImagePickerController()
正确的方法是
var picker = ELCImagePickerController(imagePicker: ())