FilePreviewNoActionbarViewController.swift 932 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // FilePreviewNoActionbarViewController.swift
  3. // Runner
  4. //
  5. // Created by FancyLou on 2024/1/18.
  6. //
  7. import UIKit
  8. class FilePreviewNoActionbarViewController: UIViewController {
  9. var doneTitle: String = "关闭"
  10. override func viewDidLoad() {
  11. super.viewDidLoad()
  12. self.view.backgroundColor = .white
  13. }
  14. override func viewWillAppear(_ animated: Bool) {
  15. super.viewWillAppear(animated)
  16. let doneBtn = UIButton(type: .system)
  17. doneBtn.frame = CGRect(x: UIScreen.main.bounds.width - 40, y: 20, width: 40, height: 40)
  18. doneBtn.setTitle( self.doneTitle, for: .normal)
  19. doneBtn.addTarget(self, action: #selector(closePreviewOutVc), for: .touchUpInside)
  20. self.view.addSubview(doneBtn);
  21. }
  22. @objc private func closePreviewOutVc() {
  23. self.dismiss(animated: true, completion: nil)
  24. print("closePreviewOutVc ===== dismiss")
  25. }
  26. }