|
@@ -0,0 +1,186 @@
|
|
|
+//
|
|
|
+// PublishMusicChooseView.swift
|
|
|
+// RainbowPlanet
|
|
|
+//
|
|
|
+// Created by Christopher on 2019/7/16.
|
|
|
+// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
|
+// 选择音乐のView
|
|
|
+
|
|
|
+import UIKit
|
|
|
+import FWPopupView
|
|
|
+import RxSwift
|
|
|
+import SwiftyMediator
|
|
|
+
|
|
|
+class PublishMusicChooseView: FWPopupView {
|
|
|
+
|
|
|
+ let disposeBag = DisposeBag()
|
|
|
+
|
|
|
+ typealias RecommendClosure = () -> Void
|
|
|
+ var recommendClosure : RecommendClosure?
|
|
|
+
|
|
|
+ override init(frame: CGRect) {
|
|
|
+ super.init(frame: frame)
|
|
|
+ setupViews()
|
|
|
+ setupLayouts()
|
|
|
+ }
|
|
|
+
|
|
|
+ required init?(coder aDecoder: NSCoder) {
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
+ }
|
|
|
+
|
|
|
+ func setupViews() {
|
|
|
+ frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
|
|
|
+ backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
|
|
|
+ configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
|
|
|
+
|
|
|
+ addSubview(cancelButton)
|
|
|
+
|
|
|
+ addSubview(recommendLabel)
|
|
|
+ addSubview(recommendButton)
|
|
|
+
|
|
|
+ addSubview(sepLineView)
|
|
|
+ addSubview(musicButton)
|
|
|
+ addSubview(volumnButton)
|
|
|
+ addSubview(v_lineLabel)
|
|
|
+ }
|
|
|
+
|
|
|
+ func setupLayouts() {
|
|
|
+
|
|
|
+ cancelButton.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(2)
|
|
|
+ make.left.equalTo(3)
|
|
|
+ make.size.equalTo(44)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 底部分割线
|
|
|
+ sepLineView.snp.makeConstraints { (make) in
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
+ make.bottom.equalTo(-48-kSafeStatusBarHeight)
|
|
|
+ make.height.equalTo(0.5)
|
|
|
+ }
|
|
|
+
|
|
|
+ recommendLabel.snp.makeConstraints { (make) in
|
|
|
+ make.centerX.equalTo(kScreenWidth*0.5-20)
|
|
|
+ make.bottom.equalTo(sepLineView.snp_top).offset(-20)
|
|
|
+ make.height.equalTo(20)
|
|
|
+ }
|
|
|
+ recommendButton.snp.makeConstraints { (make) in
|
|
|
+ make.left.equalTo(recommendLabel.snp_right)
|
|
|
+ make.height.equalTo(30)
|
|
|
+ make.centerY.equalTo(recommendLabel.snp_centerY)
|
|
|
+ make.width.equalTo(60)
|
|
|
+ }
|
|
|
+
|
|
|
+ musicButton.snp.makeConstraints { (make) in
|
|
|
+ make.centerX.equalTo(kScreenWidth*0.25)
|
|
|
+ make.bottom.equalTo(-17-kSafeStatusBarHeight)
|
|
|
+ make.width.equalTo(40)
|
|
|
+ make.height.equalTo(21)
|
|
|
+ }
|
|
|
+ volumnButton.snp.makeConstraints { (make) in
|
|
|
+ make.centerX.equalTo(kScreenWidth*0.75)
|
|
|
+ make.bottom.equalTo(-17-kSafeStatusBarHeight)
|
|
|
+ make.width.equalTo(40)
|
|
|
+ make.height.equalTo(21)
|
|
|
+ }
|
|
|
+ v_lineLabel.snp.makeConstraints { (make) in
|
|
|
+ make.centerX.equalTo(volumnButton.snp_centerX)
|
|
|
+ make.width.equalTo(20)
|
|
|
+ make.height.equalTo(3)
|
|
|
+ make.bottom.equalTo(-11-kSafeStatusBarHeight)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ lazy var cancelButton: UIButton = {
|
|
|
+ let cancelButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
+ cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)
|
|
|
+ return cancelButton
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var recommendLabel: UILabel = {
|
|
|
+ let recommendLabel = UILabel()
|
|
|
+ recommendLabel.text = "没有找到想要的音乐?"
|
|
|
+ recommendLabel.textColor = k999999Color
|
|
|
+ recommendLabel.font = kRegularFont14
|
|
|
+ return recommendLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var recommendButton: UIButton = {
|
|
|
+ let recommendButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
+ recommendButton.setTitle("点击推荐", for: UIControl.State.normal)
|
|
|
+ recommendButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
+ recommendButton.titleLabel?.font = kMediumFont14
|
|
|
+ return recommendButton
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var sepLineView: UIView = {
|
|
|
+ let sepLineView = UIView()
|
|
|
+ sepLineView.backgroundColor = k999999Color
|
|
|
+ return sepLineView
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var musicButton: UIButton = {
|
|
|
+ let musicButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
+ musicButton.setTitle("配乐", for: UIControl.State.normal)
|
|
|
+ musicButton.setTitleColor(k999999Color, for: UIControl.State.normal)
|
|
|
+ musicButton.titleLabel?.font = kRegularFont16
|
|
|
+ return musicButton
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var volumnButton: UIButton = {
|
|
|
+ let volumnButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
+ volumnButton.setTitle("音量", for: UIControl.State.normal)
|
|
|
+ volumnButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
+ volumnButton.titleLabel?.font = kMediumFont17
|
|
|
+ return volumnButton
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var v_lineLabel: UILabel = {
|
|
|
+ let v_lineLabel = UILabel()
|
|
|
+ v_lineLabel.backgroundColor = kffffffColor
|
|
|
+ v_lineLabel.cornerRadius = 1
|
|
|
+ return v_lineLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ /// 初始化View
|
|
|
+ @objc class func publishMusicChooseView() -> PublishMusicChooseView {
|
|
|
+ let view = PublishMusicChooseView()
|
|
|
+ let vProperty = FWPopupViewProperty()
|
|
|
+ vProperty.popupCustomAlignment = .bottomCenter
|
|
|
+ vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
+ vProperty.popupAnimationType = .scale
|
|
|
+ vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
|
|
|
+ vProperty.touchWildToHide = "1"
|
|
|
+ view.vProperty = vProperty
|
|
|
+ view.show()
|
|
|
+
|
|
|
+ view.cancelButton.rx.tap.subscribe(onNext: { (data) in
|
|
|
+ print("----点击了-取消")
|
|
|
+ view.hide()
|
|
|
+
|
|
|
+ }).disposed(by: view.disposeBag)
|
|
|
+
|
|
|
+
|
|
|
+ view.recommendButton.rx.tap.subscribe(onNext: {
|
|
|
+ [weak view] (data) in
|
|
|
+ view?.hide()
|
|
|
+ Mediator.push(PublishRouterModuleType.push)
|
|
|
+
|
|
|
+ }).disposed(by: view.disposeBag)
|
|
|
+
|
|
|
+ view.musicButton.rx.tap.subscribe(onNext: { (data) in
|
|
|
+ print("----点击了-配乐")
|
|
|
+
|
|
|
+ }).disposed(by: view.disposeBag)
|
|
|
+
|
|
|
+ view.volumnButton.rx.tap.subscribe(onNext: { (data) in
|
|
|
+ print("----点击了-音量")
|
|
|
+
|
|
|
+ }).disposed(by: view.disposeBag)
|
|
|
+
|
|
|
+ return view
|
|
|
+ }
|
|
|
+
|
|
|
+}
|