TaskAttachmentPreviewController.swift 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // TaskAttachmentPreviewController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2017/5/9.
  6. // Copyright © 2017年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import QuickLook
  10. class TaskAttachmentPreviewController: QLPreviewController {
  11. var currentFileURLS:[NSURL] = []
  12. override func viewDidLoad() {
  13. super.viewDidLoad()
  14. // Do any additional setup after loading the view.
  15. }
  16. override func didReceiveMemoryWarning() {
  17. super.didReceiveMemoryWarning()
  18. // Dispose of any resources that can be recreated.
  19. }
  20. @objc public func qlCloseWindow() -> Void {
  21. self.dismissVC(completion: nil)
  22. }
  23. }
  24. extension TaskAttachmentPreviewController:QLPreviewControllerDelegate,QLPreviewControllerDataSource{
  25. func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
  26. return self.currentFileURLS.count
  27. }
  28. func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
  29. return self.currentFileURLS[index]
  30. }
  31. func previewControllerWillDismiss(_ controller: QLPreviewController) {
  32. // guard #available(iOS 10,*) else{
  33. // self.showAttachmentList(UIButton(type: .custom))
  34. // return
  35. // }
  36. }
  37. }