Explorar o código

添加音乐事件级UI

harry %!s(int64=3) %!d(string=hai) anos
pai
achega
5c70e93595

+ 21 - 0
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/addmusic.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "music@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN=BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/addmusic.imageset/music@3x.png


+ 21 - 0
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/clip.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "clip@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN=BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/clip.imageset/clip@3x.png


+ 21 - 0
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/search.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "search@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN=BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/search.imageset/search@3x.png


+ 21 - 0
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/search_close.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "search_close@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN=BIN
BFRecordScreenKit/Assets/BFRecordScreenKit.xcassets/search_close.imageset/search_close@3x.png


+ 62 - 0
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -484,6 +484,35 @@ public class BFRecordScreenController: BFBaseViewController {
         btn.addTarget(self, action: #selector(cameraFlipAction), for: .touchUpInside)
         return btn
     }()
+    
+    // 添加音乐设置
+    lazy var addMusicBtn: UIButton = {
+        let btn = UIButton(type: .custom)
+        btn.backgroundColor = UIColor.black
+        btn.layer.cornerRadius = 16
+        btn.setImage(imageInRecordScreenKit(by: "addmusic"), for: .normal)
+        btn.setTitle("选择音乐", for: .normal)
+        btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
+        btn.addTarget(self, action: #selector(addMusicAction), for: .touchUpInside)
+        return btn
+    }()
+    
+    lazy var choseMusicPanel: BFChooseMusicView = {
+        let vv = BFChooseMusicView(frame: CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth - 200))
+        vv.clickBtnAction = { [weak self] type in
+            guard let wself = self else { return }
+            
+            if type == BFChooseMusicViewClickType.sure {
+                
+            }else {
+                
+            }
+            UIView.animate(withDuration: 0.25) {
+                wself.choseMusicPanel.frame = CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: cScreenHeigth - 200)
+            }
+        }
+        return vv
+    }()
 
     // 字幕设置面板
     lazy var subtitleSettingView: BFSubtitleSettingView = {
@@ -728,6 +757,9 @@ public class BFRecordScreenController: BFBaseViewController {
                 
         view.addSubview(bottomeView)
 //        view.addSubview(subtitleLabel)
+        view.addSubview(addMusicBtn)
+        view.addSubview(choseMusicPanel)
+        
         view.addSubview(playBtn)
 //        view.addSubview(avatarView)
 //        view.addSubview(openCameraBtn)
@@ -740,6 +772,8 @@ public class BFRecordScreenController: BFBaseViewController {
         }
    
         view.addSubview(cameraFlipBtn)
+        
+        
         view.addSubview(subtitleSettingView)
         view.addSubview(audioSettingView)
         //??? add key windows?
@@ -930,6 +964,13 @@ public class BFRecordScreenController: BFBaseViewController {
             make.left.bottom.right.equalToSuperview()
             make.height.equalTo(adapterWidth(width: 180))
         }
+        
+        addMusicBtn.snp.makeConstraints { make in
+            make.centerX.equalToSuperview()
+            make.top.equalTo(soundSettingBtn).offset(-8)
+            make.width.equalTo(100)
+            make.height.equalTo(32)
+        }
 
         progreddL.snp.makeConstraints { make in
             make.width.equalTo(100)
@@ -1428,6 +1469,27 @@ public class BFRecordScreenController: BFBaseViewController {
             rscmanager.cameraFlip()
         }
     }
+    
+    @objc func addMusicAction() {
+        cShowHUB(superView: nil, msg: "选择音乐")
+        
+        soundSettingBtn.isHidden = true
+        cameraFlipBtn.isHidden = true
+        voiceSettingBtn.isHidden = true
+        subtitleBtn.isHidden = true
+        addMusicBtn.isHidden = true
+        
+        UIView.animate(withDuration: 0.25) {[weak self] in
+            guard let wself = self else { return }
+            wself.soundSettingBtn.isHidden = false
+            wself.cameraFlipBtn.isHidden = false
+            wself.voiceSettingBtn.isHidden = false
+            wself.subtitleBtn.isHidden = false
+            wself.addMusicBtn.isHidden = false
+            
+            wself.choseMusicPanel.frame = CGRect(x: 0, y: 210, width: cScreenWidth, height: cScreenHeigth - 200)
+        }
+    }
 
     /// 删除指定段落的所有字幕 数据
     /// - Parameter voiceModel: 删除的音频数据

+ 57 - 0
BFRecordScreenKit/Classes/RecordScreen/View/BFChooseMusicView.swift

@@ -0,0 +1,57 @@
+//
+//  BFChooseMusicView.swift
+//  BFRecordScreenKit
+//
+//  Created by 胡志强 on 2022/2/28.
+//
+
+import Foundation
+
+enum BFChooseMusicViewClickType {
+    case sure, cancle
+}
+
+class BFChooseMusicView: UIView {
+    
+    var clickBtnAction: ((BFChooseMusicViewClickType) -> Void)?
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        
+        backgroundColor = UIColor.black
+        layer.cornerRadius = 10
+        
+        let cancelBtn = UIButton()
+        cancelBtn.tag = 1001
+        cancelBtn.frame = CGRect(x: 18, y: 17, width: 35, height: 24)
+        cancelBtn.setTitle("取消", for: .normal)
+        cancelBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#616161"), for: .normal)
+        cancelBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .regular)
+        cancelBtn.addTarget(self, action: #selector(btnAction(btn:)), for: .touchUpInside)
+        addSubview(cancelBtn)
+        
+        let sureBtn = UIButton()
+        sureBtn.tag = 1002
+        sureBtn.frame = CGRect(x: width - 35 - 18, y: 17, width: 35, height: 24)
+        sureBtn.setTitle("取消", for: .normal)
+        sureBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#616161"), for: .normal)
+        sureBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .regular)
+        sureBtn.addTarget(self, action: #selector(btnAction(btn:)), for: .touchUpInside)
+        addSubview(sureBtn)
+        
+    }
+    
+    required init?(coder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    
+    @objc func btnAction(btn:UIButton) {
+        if btn.tag == 1001 {
+            //取消
+            clickBtnAction?(.cancle)
+        }else {
+            clickBtnAction?(.sure)
+        }
+    }
+}