1. <legend id='sZ3JC'><style id='sZ3JC'><dir id='sZ3JC'><q id='sZ3JC'></q></dir></style></legend>
      <tfoot id='sZ3JC'></tfoot>

      <small id='sZ3JC'></small><noframes id='sZ3JC'>

    1. <i id='sZ3JC'><tr id='sZ3JC'><dt id='sZ3JC'><q id='sZ3JC'><span id='sZ3JC'><b id='sZ3JC'><form id='sZ3JC'><ins id='sZ3JC'></ins><ul id='sZ3JC'></ul><sub id='sZ3JC'></sub></form><legend id='sZ3JC'></legend><bdo id='sZ3JC'><pre id='sZ3JC'><center id='sZ3JC'></center></pre></bdo></b><th id='sZ3JC'></th></span></q></dt></tr></i><div id='sZ3JC'><tfoot id='sZ3JC'></tfoot><dl id='sZ3JC'><fieldset id='sZ3JC'></fieldset></dl></div>
        <bdo id='sZ3JC'></bdo><ul id='sZ3JC'></ul>

      为 UIImagePicker 设置委托返回错误

      时间:2023-09-12

        • <tfoot id='cQhMX'></tfoot>

                <tbody id='cQhMX'></tbody>

              <small id='cQhMX'></small><noframes id='cQhMX'>

                <bdo id='cQhMX'></bdo><ul id='cQhMX'></ul>

              • <i id='cQhMX'><tr id='cQhMX'><dt id='cQhMX'><q id='cQhMX'><span id='cQhMX'><b id='cQhMX'><form id='cQhMX'><ins id='cQhMX'></ins><ul id='cQhMX'></ul><sub id='cQhMX'></sub></form><legend id='cQhMX'></legend><bdo id='cQhMX'><pre id='cQhMX'><center id='cQhMX'></center></pre></bdo></b><th id='cQhMX'></th></span></q></dt></tr></i><div id='cQhMX'><tfoot id='cQhMX'></tfoot><dl id='cQhMX'><fieldset id='cQhMX'></fieldset></dl></div>
                <legend id='cQhMX'><style id='cQhMX'><dir id='cQhMX'><q id='cQhMX'></q></dir></style></legend>
                本文介绍了为 UIImagePicker 设置委托返回错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我为 OCR 翻译应用程序编写的一些快速代码存在问题.代码片段如下:

                Having a problem in some swift code I had written for an OCR translation app. The code snippet is below:

                @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)
                }
                

                image.delegate = self 行返回错误:Cannot assign a value of viewcontroller to uiimagepickerdelegate.

                The image.delegate = self line returns the error: Cannot assign a value of type viewcontroller to uiimagepickerdelegate.

                我已经在类定义中设置了委托,如下图...

                I have set the delegate in the class definition, this can be seen below...

                class ViewController: UIViewController, UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UIImagePickerControllerDelegate {    }
                

                我们将不胜感激,提前致谢.

                All and any help would be appreciated, thanks in advance.

                推荐答案

                你忘记了你的 ViewController 类定义中的 UINavigationControllerDelegate.

                You forgot about UINavigationControllerDelegate in your ViewController class defenition.

                图像选择器的委托对象.

                The image picker’s delegate object.

                声明

                unowned(unsafe) var delegate: protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?
                

                这篇关于为 UIImagePicker 设置委托返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:没有segue的两个视图控制器之间的快速委托 下一篇:在 Swift 中使用闭包实现委托?

                相关文章

                  <bdo id='P0Jja'></bdo><ul id='P0Jja'></ul>

                  <small id='P0Jja'></small><noframes id='P0Jja'>

                  <i id='P0Jja'><tr id='P0Jja'><dt id='P0Jja'><q id='P0Jja'><span id='P0Jja'><b id='P0Jja'><form id='P0Jja'><ins id='P0Jja'></ins><ul id='P0Jja'></ul><sub id='P0Jja'></sub></form><legend id='P0Jja'></legend><bdo id='P0Jja'><pre id='P0Jja'><center id='P0Jja'></center></pre></bdo></b><th id='P0Jja'></th></span></q></dt></tr></i><div id='P0Jja'><tfoot id='P0Jja'></tfoot><dl id='P0Jja'><fieldset id='P0Jja'></fieldset></dl></div>
                1. <tfoot id='P0Jja'></tfoot>
                2. <legend id='P0Jja'><style id='P0Jja'><dir id='P0Jja'><q id='P0Jja'></q></dir></style></legend>