IMFileView.swift 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // IMFileView.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2020/12/15.
  6. // Copyright © 2020 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class IMFileView: UIView {
  10. static let IMFileView_width: CGFloat = 175
  11. static let IMFileView_height: CGFloat = 75
  12. override func awakeFromNib() { }
  13. @IBOutlet weak var fileIcon: UIImageView!
  14. @IBOutlet weak var fileNameLabel: UILabel!
  15. func setFile(name: String, fileExt: String?) {
  16. self.fileNameLabel.text = name
  17. // self.setFileTypeImage(ext: fileExt)
  18. self.fileIcon.image = UIImage(named: O2.fileExtension2Icon(fileExt))
  19. }
  20. // private func setFileTypeImage(ext: String?) {
  21. // if let type = ext {
  22. // switch type {
  23. // case "jpg", "png", "jepg", "gif":
  24. // self.fileIcon.image = UIImage(named: "icon_img")
  25. // break
  26. // case "html":
  27. // self.fileIcon.image = UIImage(named: "icon_html")
  28. // break
  29. // case "xls", "xlsx":
  30. // self.fileIcon.image = UIImage(named: "icon_excel")
  31. // break
  32. // case "doc", "docx":
  33. // self.fileIcon.image = UIImage(named: "icon_word")
  34. // break
  35. // case "ppt", "pptx":
  36. // self.fileIcon.image = UIImage(named: "icon_ppt")
  37. // break
  38. // case "pdf":
  39. // self.fileIcon.image = UIImage(named: "icon_pdf")
  40. // break
  41. // case "mp4":
  42. // self.fileIcon.image = UIImage(named: "icon_mp4")
  43. // break
  44. // case "mp3":
  45. // self.fileIcon.image = UIImage(named: "icon_mp3")
  46. // break
  47. // case "zip", "rar", "7z":
  48. // self.fileIcon.image = UIImage(named: "icon_zip")
  49. // break
  50. // default :
  51. // self.fileIcon.image = UIImage(named: "icon_file_more")
  52. // break
  53. // }
  54. // }else {
  55. // self.fileIcon.image = UIImage(named: "icon_file_more")
  56. // }
  57. // }
  58. }