CloudFilePreviewController.swift 858 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // CloudFilePreviewController.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2019/11/8.
  6. // Copyright © 2019 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import CocoaLumberjack
  10. import QuickLook
  11. //文件预览
  12. class CloudFilePreviewController: QLPreviewController {
  13. var currentFileURLS:[NSURL] = []
  14. override func viewDidLoad() {
  15. super.viewDidLoad()
  16. self.delegate = self
  17. self.dataSource = self
  18. }
  19. }
  20. extension CloudFilePreviewController: QLPreviewControllerDelegate,QLPreviewControllerDataSource {
  21. func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
  22. return self.currentFileURLS.count
  23. }
  24. func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
  25. return self.currentFileURLS[index]
  26. }
  27. }