gpt4 book ai didi

ios - 无法将类型 'Class' 的值分配给类型 'protocol?'

转载 作者:行者123 更新时间:2023-11-28 21:34:26 25 4
gpt4 key购买 nike

我希望之前有人遇到过这个问题。我正在尝试将此类指定为 UIImagePickerController 的委托(delegate),但出现此错误:

“PictureViewController.swift:40:32:无法将类型‘PictureViewController’的值分配给类型‘协议(protocol)?’”

有什么想法吗?提前致谢。

import UIKit
import MVCarouselCollectionView
import Eureka
import RealmSwift

public class PictureViewController<T: Equatable>: FormViewController, TypedRowControllerType,
MVCarouselCollectionViewDelegate, UIImagePickerControllerDelegate{

public var row: RowOf<T>!
public var completionCallback : ((UIViewController) -> ())?
let imagePicker = UIImagePickerController()

public override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.setRightBarButtonItem(
UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "loadImageButtonTapped:"), animated: true)

imagePicker.delegate = self <<<==== THIS GIVES ERROR MESSAGE
}

最佳答案

其实我已经明白了。我还必须声明该类实现了 UINavigationControllerDelegate 并且现在一切正常。

关于ios - 无法将类型 'Class<T>' 的值分配给类型 'protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34477268/

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