我试图加载一个tableview xib
包含一个collectionView
. collectionView
包含要下载和打开的文件列表。
class CommentsCell: UITableViewCell, UICollectionViewDelegate, UICollectionViewDataSource, UIDocumentInteractionControllerDelegate {
var dic = UIDocumentInteractionController()
var imgCollection: [TicketAttachment] = [TicketAttachment]()
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var imgProfilePic: UIImageView!
@IBOutlet weak var lblName: UILabel!
@IBOutlet weak var lblDate: UILabel!
@IBOutlet weak var txvComments: UITextView!
override func awakeFromNib() {
super.awakeFromNib()
dic.delegate = self
self.collectionView.dataSource = self
self.collectionView.delegate = self
self.collectionView.register(UINib.init(nibName: "AttachmentViewCell", bundle: nil), forCellWithReuseIdentifier: "AttachmentViewCell")
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let fileUrl = imgCollection[indexPath.row].fileUrl?.absoluteString
let url = URL(string: Api.domain + fileUrl!)
let destination = DownloadRequest.suggestedDownloadDestination(for: .documentDirectory)
sharedAFManager.AFManager.download(url!, to: destination)
.downloadProgress(closure: { _ in
SVProgressHUD.show()
}).response(completionHandler: { (downloadResponse) in
SVProgressHUD.dismiss()
self.dic.url = downloadResponse.destinationURL
self.dic.uti = downloadResponse.destinationURL!.uti
let rect = CGRect(x: 0, y: 0, width: 100, height: 100)
self.dic.presentOpenInMenu(from: rect, in: self.view, animated: true)
})
}
self.dic.presentOpenInMenu(来自:rect,in:self.view,动画:true)“CommentsCell”类型的值没有成员“view”
Tableview XIB 设计: