无故事王国
2023-10-24 7d03245e828bbf89a7a875f8353c5ec3f26216dc
BrokerDriver/Home/VC/HomeDetailAttachVC.swift
@@ -41,6 +41,7 @@
    override func viewDidLoad() {
        super.viewDidLoad()
      view.jq_height = 1000
        view.backgroundColor = UIColor(hexStr: "#F9FAFF")
        attachTableView.delegate = self
        attachTableView.dataSource = self
@@ -70,14 +71,20 @@
    }
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let totalHeight = adapterViewController.headHeight
      let totalHeight = adapterViewController?.headHeight ?? 0
        let offset =  totalHeight - scrollView.contentOffset.y
        let isTop = (offset - topSafeHeight) < 0
        if scrollView.contentOffset.y > 0 && !isTop{
            adapterViewController.scrollview.contentOffset = scrollView.contentOffset
      if scrollView.contentOffset.y >= 0 {
         if isTop{
            print("-->1")
            adapterViewController?.scrollview.contentOffset = CGPoint(x: 0, y: totalHeight - topSafeHeight)
         }else if scrollView.contentOffset.y <= 0{
            print("-->2")
            adapterViewController?.scrollview.setContentOffset(.zero, animated: true)
         }else{
            print("-->3")
            adapterViewController?.scrollview.contentOffset = scrollView.contentOffset
         }
        }
    }