Commit 38ffa336 authored by David黄金龙's avatar David黄金龙

1、删除测试代码

2、优化个人信息中的滚动逻辑
parent 3a8e243c
...@@ -308,12 +308,12 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource { ...@@ -308,12 +308,12 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// if section == 0 { if section == 0 {
// return 6 return 6
// } }
// return 1//for test hjl return 1//for test hjl
return 0 //for test hjl // return 0 //for test hjl
} }
...@@ -403,9 +403,9 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource { ...@@ -403,9 +403,9 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.row)") printLog("点击了 tableView Cell \(indexPath.row)")
let vc = YHNewWebViewController() // let vc = YHNewWebViewController()
vc.url = "https://cloudapi.qiyuesuo.cn/contract/share/3203196638675878889?openPageToken=1c9e8a62-eeb5-4651-9a13-adf335ae3dbe" // vc.url = "https://cloudapi.qiyuesuo.cn/contract/share/3203196638675878889?openPageToken=1c9e8a62-eeb5-4651-9a13-adf335ae3dbe"
self.navigationController?.pushViewController(vc) // self.navigationController?.pushViewController(vc)
// https://cloudapi.qiyuesuo.cn/contract/share/3202449385770287813?openPageToken=d004e5af-aab9-43e4-b813-c5a6a8c16497 // https://cloudapi.qiyuesuo.cn/contract/share/3202449385770287813?openPageToken=d004e5af-aab9-43e4-b813-c5a6a8c16497
} }
} }
......
...@@ -40,27 +40,6 @@ class YHPreviewBaseViewController: YHBaseViewController { ...@@ -40,27 +40,6 @@ class YHPreviewBaseViewController: YHBaseViewController {
} }
} }
// MARK: - 滑动使用
extension YHPreviewBaseViewController: UIScrollViewDelegate {
//控制滑动交互
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let scrollViewSet: CGFloat = scrollView.contentOffset.y
if vcCanScroll == false {//不能滚动时
scrollView.contentOffset = CGPoint(x: 0, y: 0)
} else {
if (scrollViewSet <= 0) {
scrollView.contentOffset = CGPoint(x: 0, y: 0)
vcCanScroll = false
NotificationCenter.default.post(name: Notification.Name(rawValue: "leaveTop0"), object: nil)
} else {
scrollView.contentOffset = CGPoint(x: 0, y: scrollViewSet)
}
}
}
}
// MARK: - JXSegmentedListContainerViewListDelegate // MARK: - JXSegmentedListContainerViewListDelegate
extension YHPreviewBaseViewController: JXSegmentedListContainerViewListDelegate { extension YHPreviewBaseViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView { func listView() -> UIView {
...@@ -102,3 +81,23 @@ extension YHPreviewBaseViewController : UITableViewDelegate,UITableViewDataSourc ...@@ -102,3 +81,23 @@ extension YHPreviewBaseViewController : UITableViewDelegate,UITableViewDataSourc
} }
} }
// MARK: - 滑动使用
extension YHPreviewBaseViewController: UIScrollViewDelegate {
//控制滑动交互
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let scrollViewSet: CGFloat = scrollView.contentOffset.y
if vcCanScroll == false {//不能滚动时
scrollView.contentOffset = CGPoint(x: 0, y: 0)
} else {
if (scrollViewSet <= 0) {
scrollView.contentOffset = CGPoint(x: 0, y: 0)
vcCanScroll = false
NotificationCenter.default.post(name: Notification.Name(rawValue: "leaveTop0"), object: nil)
} else {
scrollView.contentOffset = CGPoint(x: 0, y: scrollViewSet)
}
}
}
}
...@@ -104,21 +104,6 @@ class YHPreviewMainViewController: YHBaseViewController { ...@@ -104,21 +104,6 @@ class YHPreviewMainViewController: YHBaseViewController {
// MARK: - 私有方法 // MARK: - 私有方法
extension YHPreviewMainViewController { extension YHPreviewMainViewController {
@objc func leaveTopOp() {
canScroll = true
}
@objc func beginDragging() {
homeTableView.isScrollEnabled = false
canScroll = false
}
@objc func endDragging() {
homeTableView.isScrollEnabled = true
canScroll = true
}
func loadData() { func loadData() {
if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") { if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {
previewVM.getPreviewForMainApplicationInfo(params: ["order_id" : orderID]) { success, error in previewVM.getPreviewForMainApplicationInfo(params: ["order_id" : orderID]) { success, error in
...@@ -279,10 +264,14 @@ extension YHPreviewMainViewController: UIScrollViewDelegate { ...@@ -279,10 +264,14 @@ extension YHPreviewMainViewController: UIScrollViewDelegate {
if (scrollView.contentOffset.y >= bottomCellOffset) { if (scrollView.contentOffset.y >= bottomCellOffset) {
scrollView.contentOffset = CGPointMake(0, bottomCellOffset) scrollView.contentOffset = CGPointMake(0, bottomCellOffset)
if canScroll == true { if canScroll == true {
// canScroll = false
// //传递参数到 子VC
// cellView.canScroll = true
}
canScroll = false canScroll = false
//传递参数到 子VC //传递参数到 子VC
cellView.canScroll = true cellView.canScroll = true
}
}else{ }else{
if canScroll == false { if canScroll == false {
scrollView.contentOffset = CGPoint(x: 0, y: bottomCellOffset) scrollView.contentOffset = CGPoint(x: 0, y: bottomCellOffset)
...@@ -291,3 +280,19 @@ extension YHPreviewMainViewController: UIScrollViewDelegate { ...@@ -291,3 +280,19 @@ extension YHPreviewMainViewController: UIScrollViewDelegate {
self.homeTableView.showsVerticalScrollIndicator = false self.homeTableView.showsVerticalScrollIndicator = false
} }
} }
extension YHPreviewMainViewController {
@objc func leaveTopOp() {
canScroll = true
}
@objc func beginDragging() {
homeTableView.isScrollEnabled = false
canScroll = false
}
@objc func endDragging() {
homeTableView.isScrollEnabled = true
canScroll = true
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment