Explorar o código

1.字幕点击

wenweiwei %!s(int64=3) %!d(string=hai) anos
pai
achega
414fe96c4d

+ 14 - 6
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -288,13 +288,13 @@ public class BFRecordScreenController: BFBaseViewController {
     // 显示字幕
     lazy var subtitleLabel: PQSubTitleLabel = {
         let subtitleLabel = PQSubTitleLabel()
+        subtitleLabel.tag = 100100
         subtitleLabel.textAlignment = .center
         subtitleLabel.numberOfLines = 0
         subtitleLabel.lineBreakMode = .byWordWrapping
         subtitleLabel.isUserInteractionEnabled = true
         subtitleLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editSubtitle)))
         return subtitleLabel
-
     }()
 
     // 音量设置
@@ -315,7 +315,7 @@ public class BFRecordScreenController: BFBaseViewController {
     }()
 
     lazy var progressThumV: BFVideoThumbProgressView = {
-        let vv = BFVideoThumbProgressView(frame: CGRect(x: 0, y: 54, width: cScreenWidth, height: 50))
+        let vv = BFVideoThumbProgressView(frame: CGRect(x: 0, y: 18, width: cScreenWidth, height: 50))
         vv.dragStartHandle = { [weak self] in
             self?.isDragingProgressSlder = true
             self?.pause()
@@ -605,7 +605,7 @@ public class BFRecordScreenController: BFBaseViewController {
         //        view.addSubview(playView!)
         fetchVideo()
         view.addSubview(bottomeView)
-        view.addSubview(subtitleLabel)
+//        view.addSubview(subtitleLabel)
         view.addSubview(playBtn)
         view.addSubview(avatarView)
         //        view.addSubview(openCameraBtn)
@@ -730,20 +730,20 @@ public class BFRecordScreenController: BFBaseViewController {
     func layoutsubview() {
         bottomeView.snp.makeConstraints { make in
             make.left.bottom.right.equalToSuperview()
-            make.height.equalTo(adapterWidth(width: 220))
+            make.height.equalTo(adapterWidth(width: 180))
         }
 
         progreddL.snp.makeConstraints { make in
             make.width.equalTo(100)
             make.centerX.equalToSuperview()
-            make.bottom.equalTo(progressThumV.snp.top)
+            make.top.equalToSuperview()
             make.height.equalTo(18)
         }
 
         withDrawBtn.snp.makeConstraints { make in
             make.left.equalToSuperview()
             make.width.height.equalTo(65)
-            make.top.equalTo(128)
+            make.top.equalTo(88)
         }
         //        changeVoiceBtn.snp.makeConstraints { make in
         //            make.right.equalToSuperview()
@@ -980,6 +980,11 @@ public class BFRecordScreenController: BFBaseViewController {
         }
         // 录制中不显示播放按钮
         playBtn.isSelected = true
+        
+        let cell = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
+        if cell?.contentView.viewWithTag(100100)?.superview == nil {
+            cell?.contentView.addSubview(subtitleLabel)
+        }
     }
 
     @objc func endRecord() {
@@ -1880,6 +1885,9 @@ extension BFRecordScreenController: UICollectionViewDelegate, UICollectionViewDa
             }
 
             // add by ak 切换后刷新字幕
+            subtitleLabel.removeFromSuperview()
+            let cell = collectionView.cellForItem(at: IndexPath(item: page, section: 0)) as? BFImageCoverViewCell
+            cell?.contentView.addSubview(subtitleLabel)
             updateSubtitle(time: currentAssetProgress)
         }
     }