|
@@ -16,7 +16,8 @@ enum BFMuicInfoCellState {
|
|
|
|
|
|
class BFMuicInfoCell: UITableViewCell {
|
|
|
var cutCallBack : (() -> Void)?
|
|
|
-
|
|
|
+ var useCallback : (() -> Void)?
|
|
|
+
|
|
|
var data:PQVoiceModel?{
|
|
|
didSet{
|
|
|
addData()
|
|
@@ -87,6 +88,25 @@ class BFMuicInfoCell: UITableViewCell {
|
|
|
return l
|
|
|
}()
|
|
|
|
|
|
+ lazy var cutBtn : UIButton = {
|
|
|
+ let cutBtn = UIButton()
|
|
|
+ cutBtn.tag = 2001
|
|
|
+ cutBtn.setImage(imageInRecordScreenKit(by: "clip"), for: .normal)
|
|
|
+ cutBtn.addTarget(self, action: #selector(cutAction), for: .touchUpInside)
|
|
|
+ return cutBtn
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var useBtn : UIButton = {
|
|
|
+ let useBtn = UIButton()
|
|
|
+ useBtn.tag = 2002
|
|
|
+ useBtn.setTitle("使用", for: .normal)
|
|
|
+ useBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#389AFF")
|
|
|
+ useBtn.layer.cornerRadius = 4
|
|
|
+ useBtn.titleLabel?.font = UIFont.systemFont(ofSize: 14)
|
|
|
+ useBtn.addTarget(self, action: #selector(useBtnAction), for: .touchUpInside)
|
|
|
+ return useBtn
|
|
|
+ }()
|
|
|
+
|
|
|
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
self.backgroundColor = .clear
|
|
@@ -100,8 +120,32 @@ class BFMuicInfoCell: UITableViewCell {
|
|
|
iconIV.addSubview(audioStateView)
|
|
|
contentView.addSubview(iconIV)
|
|
|
|
|
|
+
|
|
|
titleL.frame = CGRect(x: iconIV.rightX + 10, y: 12, width: width - iconIV.rightX - 10 - 90, height: 40)
|
|
|
+ contentView.addSubview(useBtn)
|
|
|
+ useBtn.snp.makeConstraints { make in
|
|
|
+ make.right.equalTo(-16)
|
|
|
+ make.width.equalTo(0)
|
|
|
+ make.height.equalTo(40)
|
|
|
+ make.top.equalTo(12)
|
|
|
+ }
|
|
|
+
|
|
|
+ contentView.addSubview(cutBtn)
|
|
|
+ cutBtn.snp.makeConstraints { make in
|
|
|
+ make.right.equalTo(useBtn.snp.left).offset(-2)
|
|
|
+ make.width.equalTo(0)
|
|
|
+ make.height.equalTo(40)
|
|
|
+ make.top.equalTo(12)
|
|
|
+ }
|
|
|
+
|
|
|
contentView.addSubview(titleL)
|
|
|
+ titleL.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(iconIV.snp.right).offset(10)
|
|
|
+ make.top.equalTo(12)
|
|
|
+ make.height.equalTo(40)
|
|
|
+ make.right.equalTo(cutBtn.snp.left).offset(-2)
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -134,28 +178,17 @@ class BFMuicInfoCell: UITableViewCell {
|
|
|
titleL.font = UIFont.systemFont(ofSize: 16, weight: .regular)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- func createCutBtn() -> UIButton {
|
|
|
- let cutBtn = UIButton()
|
|
|
- cutBtn.tag = 2001
|
|
|
- cutBtn.setImage(imageInRecordScreenKit(by: "clip"), for: .normal)
|
|
|
- cutBtn.addTarget(self, action: #selector(cutAction), for: .touchUpInside)
|
|
|
- return cutBtn
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
func showFunctionBtn() {
|
|
|
- let cutBtn = createCutBtn()
|
|
|
- contentView.addSubview(cutBtn)
|
|
|
- cutBtn.snp.makeConstraints { make in
|
|
|
- make.right.equalTo(-18)
|
|
|
- make.width.height.equalTo(40)
|
|
|
- make.top.equalTo(12)
|
|
|
+ cutBtn.snp.updateConstraints { make in
|
|
|
+ make.width.equalTo(40)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func hiddenFunctionBtn() {
|
|
|
- if let v = contentView.viewWithTag(2001) {
|
|
|
- v.removeFromSuperview()
|
|
|
+ cutBtn.snp.updateConstraints { make in
|
|
|
+ make.width.equalTo(0)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -163,6 +196,11 @@ class BFMuicInfoCell: UITableViewCell {
|
|
|
cutCallBack?()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @objc func useBtnAction() {
|
|
|
+ useCallback?()
|
|
|
+ }
|
|
|
+
|
|
|
func loadingAnimation(){
|
|
|
let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
|
|
|
|