123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // INIntrocudeController.swift
- // Introduce
- //
- // Created by 胡志强 on 2021/11/29.
- //
- import BFCommonKit
- import BFRecordScreenKit
- import BFUIKit
- import Foundation
- import Photos
- import UIKit
- class INIntroduceController: BFBaseViewController {
- var stripSwithView: BFStripSwithView?
- let exportBtn = UIButton()
- var assets: [PHAsset]? {
- didSet {
- if let ass = assets {
- recordScreenVC.assets = ass
- }
- }
- }
- let recordScreenVC = BFRecordScreenController()
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- showNavigation()
- PQNotification.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
- PQNotification.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
- }
- override func viewWillDisappear(_ animated: Bool) {
- super.viewWillDisappear(animated)
- PQNotification.removeObserver(self)
- }
- @objc internal func keyboardWillHide(_: Notification?) {
- navHeadImageView?.isHidden = false
- }
- @objc internal func keyboardWillShow(_: Notification?) {
- navHeadImageView?.isHidden = true
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- navHeadImageView?.backgroundColor = .clear
- leftButton(image: nil, imageName: nil, tintColor: .white)
- exportBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#28BE67")
- exportBtn.setTitle("导出", for: .normal)
- exportBtn.addCorner(corner: 4)
- exportBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
- exportBtn.addTarget(self, action: #selector(exportAction), for: .touchUpInside)
- navHeadImageView?.addSubview(exportBtn)
- exportBtn.frame = CGRect(x: (navHeadImageView?.frame.width ?? 0) - 12 - 60, y: 0, width: 60, height: 36)
- exportBtn.center.y = backButton?.center.y ?? 0
- addChild(recordScreenVC)
- recordScreenVC.view.frame = view.frame
- view.addSubview(recordScreenVC.view)
- recordScreenVC.changeItemHandle = { [weak self] index in
- self?.stripSwithView?.changeSwitchStatus(index: index)
- }
- if assets != nil, (assets?.count ?? 0) > 1 {
- stripSwithView = BFStripSwithView(frame: CGRect(x: (backButton?.frame.maxX ?? 0), y: 0, width: exportBtn.frame.minX - (backButton?.frame.maxX ?? 0) - 10, height: cDevice_iPhoneNavBarHei), items: assets?.count ?? 1)
- stripSwithView?.center.y = backButton?.center.y ?? 0
- stripSwithView?.itemClickHandle = { [weak self] _, index in
- self?.recordScreenVC.updateContentOffset(index: index)
- }
- navHeadImageView?.addSubview(stripSwithView!)
- }
- }
- override func backBtnClick() {
-
- let alertController = UIAlertController(title: "退出将不会保存当前操作",
- message: "", preferredStyle: .alert)
- let cancelAction = UIAlertAction(title: "不退出", style: .default, handler: nil)
- let okAction = UIAlertAction(title: "确认退出", style: .cancel, handler: {[weak self]
- action in
- print("点击了确定")
- self?.recordScreenVC.backBtnClick()
- self?.super_back()
- })
- okAction.setValue(UIColor.red, forKey:"titleTextColor")
- alertController.addAction(okAction)
- alertController.addAction(cancelAction)
- self.present(alertController, animated: true, completion: nil)
-
- }
- private func super_back() {
- super.backBtnClick()
- }
- @objc func exportAction() {
- recordScreenVC.backBtnClick()
- let controller = INVideoExportController()
- controller.export.data = recordScreenVC.itemModels
- controller.export.originSoundVolumn = recordScreenVC.noSpeakVolume
- controller.export.originSoundInRecordVolumn = recordScreenVC.haveSpeakVolume
- navigationController?.pushViewController(controller, animated: true)
- }
- }
|