EmptyVC.swift 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // EmptyVC.swift
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by Niehaoyu on 2024/9/13.
  6. //
  7. import Cocoa
  8. import KMComponentLibrary
  9. class EmptyVC: NSViewController {
  10. @IBOutlet weak var emptyView: ComponentEmpty!
  11. @IBOutlet weak var showTitleBtn: NSButton!
  12. @IBOutlet weak var showSubTitleBtn: NSButton!
  13. override func viewDidLoad() {
  14. super.viewDidLoad()
  15. // Do view setup here.
  16. self.reloadData()
  17. }
  18. func reloadData() {
  19. var title: String = ""
  20. if self.showTitleBtn.state == .on {
  21. title = "Title-Title"
  22. }
  23. var subtitle: String = ""
  24. if self.showSubTitleBtn.state == .on {
  25. subtitle = "subTitle-subTitle"
  26. }
  27. let emptyProperty = ComponentEmptyProperty(image: ComponentLibrary.shared.image(forResource: "test"), text: title, subText: subtitle)
  28. emptyView.properties = emptyProperty
  29. }
  30. @IBAction func clickAction(_ sender: Any) {
  31. self.reloadData()
  32. }
  33. }