我正在关注 UIDocumentMenuViewController 的 Apple 文档,以下是我的代码。importMenu.delegate = self 不起作用,Xcode 显示:无法将“ViewController”类型的值分配给“UIDocumentMenuDelegate?” . 请帮忙。谢谢!
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let importMenu = UIDocumentMenuViewController(documentTypes: ["public.text", "public.data"], inMode: .Import)
importMenu.delegate = self
self.presentViewController(importMenu, animated: true, completion: nil)
}
}