| | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | view.jq_height = 1000 |
| | | view.backgroundColor = UIColor(hexStr: "#F9FAFF") |
| | | attachTableView.delegate = self |
| | | attachTableView.dataSource = self |
| | |
| | | } |
| | | |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | | |