Bläddra i källkod

1,UI 调整

jsonwang 3 år sedan
förälder
incheckning
6d4e2a1ac2
1 ändrade filer med 24 tillägg och 4 borttagningar
  1. 24 4
      BFFramework/Classes/Stuckpoint/View/PQStuckPointCuttingView.swift

+ 24 - 4
BFFramework/Classes/Stuckpoint/View/PQStuckPointCuttingView.swift

@@ -180,11 +180,15 @@ class PQStuckPointCuttingView: UIView {
             contentWidth = scrollView.frame.width
         }
         scrollView.contentSize = CGSize(width: contentWidth, height: scrollView.frame.height)
+        
+        
         for index in 0 ... timeLabelCount {
+            scrollView.viewWithTag(100 + index)?.removeFromSuperview()
             let titleLab = UILabel(frame: CGRect(x: CGFloat(index) * (timeLineWidth + timeLineMargin) + margin, y: rateView.frame.maxY, width: timeLineWidth, height: 30))
             titleLab.font = UIFont.systemFont(ofSize: 11)
             titleLab.textAlignment = .center
             titleLab.numberOfLines = 1
+            titleLab.tag = 100 + index
             titleLab.backgroundColor = .clear
             titleLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
             titleLab.text = "\((Float64(index) * Float64(timeRange)).formatDurationToHMS())"
@@ -299,6 +303,19 @@ class PQStuckPointCuttingView: UIView {
     deinit {
         BFLog(message: "卡点裁剪-裁剪视图销毁")
     }
+    
+    //划动结速后处理
+    func moveEnd() {
+        //最后一个竖线VIEW
+        let lastLine:UIView = scrollView.viewWithTag(100 +  Int(videoDuration / timeRange) - 1) ?? UIView.init()
+        //移动后的开始时间
+        let startTime =  videoDuration / lastLine.frame.maxX * scrollView.contentOffset.x
+        BFLog(message: "拖拽结束 - 回调\(scrollView.contentOffset)  \(scrollView.contentSize) 开始时间为:\(startTime)")
+        if(videoDidEndDragging != nil){
+            videoDidEndDragging!(1,startTime,startTime + CGFloat(stuckPointEndTime - stuckPointStartTime),0)
+        }
+        resetDefaultsColor()
+    }
 }
 
 // MARK: - scrollView滑动代理
@@ -308,12 +325,15 @@ extension PQStuckPointCuttingView: UIScrollViewDelegate {
     func scrollViewDidScroll(_: UIScrollView) {}
 
     func scrollViewDidEndDecelerating(_: UIScrollView) {
-        BFLog(message: "拖拽结束 - 回调")
-        resetDefaultsColor()
+//        moveEnd()
     }
-
+    func scrollViewDidEndDragging(_:UIScrollView,willDecelerate:Bool){
+//        moveEnd()
+    }
+    
     func scrollViewDidEndScrollingAnimation(_: UIScrollView) {
         BFLog(message: "scrollViewDidEndScrollingAnimation")
-        resetDefaultsColor()
+   
+        
     }
 }