Browse Source

音量View

Chris 5 years ago
parent
commit
7dc88b440a

+ 28 - 30
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift

@@ -14,8 +14,8 @@ class PublishMusicVolumnView: FWPopupView {
     
     let disposeBag = DisposeBag()
     
-    var originVolumn: Float = 50
-    var backVolumn: Float   = 100
+    var originVolumn: Float = 0.5
+    var backVolumn: Float   = 1.0
     
     override init(frame: CGRect) {
         super.init(frame: frame)
@@ -28,31 +28,25 @@ class PublishMusicVolumnView: FWPopupView {
     }
     
     func setupViews() {
-        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight)
-        backgroundColor = UIColor(hexString: "FFFFFF", alpha: 0.2)
+        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: 177)
+        backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
+        configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
         
-        addSubview(controlBackView)
-        controlBackView.addSubview(cancelButton)
-        controlBackView.addSubview(applyButton)
+        addSubview(cancelButton)
+        addSubview(applyButton)
         
-        controlBackView.addSubview(originLabel)
-        controlBackView.addSubview(originSlider)
-        controlBackView.addSubview(backLabel)
-        controlBackView.addSubview(backSlider)
+        addSubview(originLabel)
+        addSubview(originSlider)
+        addSubview(backLabel)
+        addSubview(backSlider)
         
-        controlBackView.addSubview(musicButton)
-        controlBackView.addSubview(volumnButton)
-        controlBackView.addSubview(v_lineLabel)
+        addSubview(musicButton)
+        addSubview(volumnButton)
+        addSubview(v_lineLabel)
     }
     
     func setupLayouts() {
         
-        controlBackView.snp.makeConstraints { (make) in
-            make.left.right.equalToSuperview()
-            make.bottom.equalTo(-kSafeStatusBarHeight)
-            make.height.equalTo(177)
-        }
-        
         cancelButton.snp.makeConstraints { (make) in
             make.top.equalTo(2)
             make.left.equalTo(3)
@@ -70,22 +64,33 @@ class PublishMusicVolumnView: FWPopupView {
             make.width.equalTo(30)
             make.height.equalTo(21)
         }
-        
         backLabel.snp.makeConstraints { (make) in
             make.top.equalTo(78)
             make.left.equalTo(kScreenWidth/2 + 13)
             make.width.equalTo(30)
             make.height.equalTo(21)
         }
+        originSlider.snp.makeConstraints { (make) in
+            make.left.equalTo(originLabel.snp_right).offset(6)
+            make.right.equalTo(backLabel.snp_left).offset(-20)
+            make.height.equalTo(10)
+            make.centerY.equalTo(originLabel.snp_centerY)
+        }
+        backSlider.snp.makeConstraints { (make) in
+            make.left.equalTo(backLabel.snp_right).offset(6)
+            make.right.equalTo(-14)
+            make.height.equalTo(10)
+            make.centerY.equalTo(backLabel.snp_centerY)
+        }
         
         musicButton.snp.makeConstraints { (make) in
-            make.centerX.equalTo(controlBackView.snp_right).multipliedBy(0.25)
+            make.centerX.equalTo(kScreenWidth*0.25)
             make.bottom.equalTo(-17)
             make.width.equalTo(40)
             make.height.equalTo(21)
         }
         volumnButton.snp.makeConstraints { (make) in
-            make.centerX.equalTo(controlBackView.snp_right).multipliedBy(0.75)
+            make.centerX.equalTo(kScreenWidth*0.75)
             make.bottom.equalTo(-17)
             make.width.equalTo(40)
             make.height.equalTo(21)
@@ -98,13 +103,6 @@ class PublishMusicVolumnView: FWPopupView {
         }
     }
     
-    lazy var controlBackView: UIView = {
-        let controlBackView = UIView()
-        controlBackView.backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
-        controlBackView.configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
-        return controlBackView
-    }()
-    
     lazy var cancelButton: UIButton = {
         let cancelButton = UIButton(type: UIButton.ButtonType.custom)
         cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)