我为OCR翻译应用程序编写的swift代码有问题.
@IBAction func btnOCR(sender: AnyObject) {
var languageAlert = UIAlertController(title: "For Your Information...", message: "The OCR feature currently only supports English & French.", preferredStyle: .Alert)
languageAlert.addAction(UIAlertAction(title: "Okay", style: .Default, handler: { action in
var image = UIImagePickerController()
image.sourceType = UIImagePickerControllerSourceType.Camera
image.allowsEditing = false
image.delegate = self
presentViewController(image, animated: true, completion: nil)
}))
self.presentViewController(languageAlert, animated: true, completion: nil)
}
图像.delegate=self行返回错误:无法将viewcontroller类型的值分配给uiimagepickerdelegate.
我已经在类定义中设置了委托,这可以在下面看到...
class ViewController: UIViewController, UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UIImagePickerControllerDelegate { }
感谢您的帮助,谢谢.