簡體   English   中英

如何在Swift的表格視圖控制器中使用圖像選擇器?

[英]How to use a image picker in table view controller in Swift?

我正在按照本教程創建圖像選擇器,可以從UITableViewController訪問該圖像選擇器。 但是,它無法在此行中編譯:

imagePicker.delegate = self

出現此錯誤:

Cannot assign value of type 'ProfileTableViewController' to type 'protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?'

我該如何解決? 我的課:

class ProfileTableViewController: UITableViewController,UIGestureRecognizerDelegate,UIImagePickerControllerDelegate {
override func viewDidLoad() {
      imagePicker.delegate = self
}

為該類實現UINavigationControllerDelegate可以解決此問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM