Commit 053388a7 authored by David黄金龙's avatar David黄金龙

删除 测试代码

parent ca39d88f
...@@ -97,8 +97,6 @@ class YHDavidTestViewController: YHBaseViewController { ...@@ -97,8 +97,6 @@ class YHDavidTestViewController: YHBaseViewController {
collectinoView.translatesAutoresizingMaskIntoConstraints = false collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true collectinoView.alwaysBounceVertical = true
return collectinoView return collectinoView
}() }()
...@@ -108,13 +106,8 @@ class YHDavidTestViewController: YHBaseViewController { ...@@ -108,13 +106,8 @@ class YHDavidTestViewController: YHBaseViewController {
view.backgroundColor = .white view.backgroundColor = .white
gk_navigationBar.isHidden = true gk_navigationBar.isHidden = true
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")] self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
// self.myCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false)
self.myCollectView.reloadData() self.myCollectView.reloadData()
} }
} }
...@@ -123,7 +116,7 @@ extension YHDavidTestViewController { ...@@ -123,7 +116,7 @@ extension YHDavidTestViewController {
private func loadFirstItem() { private func loadFirstItem() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")] self.items = [AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"),AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")]
self.myCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false) self.myCollectView.es.stopPullToRefresh(ignoreDate: true,ignoreFooter: false)
self.myCollectView.reloadData() self.myCollectView.reloadData()
} }
...@@ -133,7 +126,11 @@ extension YHDavidTestViewController { ...@@ -133,7 +126,11 @@ extension YHDavidTestViewController {
private func loadFakeData() { private func loadFakeData() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高")) self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.items.append(AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高"))
self.myCollectView.es.stopLoadingMore() self.myCollectView.es.stopLoadingMore()
self.myCollectView.reloadData() self.myCollectView.reloadData()
} }
...@@ -142,84 +139,11 @@ extension YHDavidTestViewController { ...@@ -142,84 +139,11 @@ extension YHDavidTestViewController {
func setupUI() { func setupUI() {
gk_navTitle = "David的测试UI" gk_navTitle = "David的测试UI"
view.backgroundColor = .white view.backgroundColor = .white
// view.addSubview(bannerView)
//
// let bannerHeight: CGFloat = 143/343 * (KScreenWidth - 16 * 2)
// bannerView.snp.makeConstraints { make in
// make.top.left.right.equalToSuperview()
// make.height.equalTo(bannerHeight)
// }
//
// let subHoldView = UIView()
// subHoldView.layer.backgroundColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1).cgColor
// subHoldView.layer.borderWidth = 0.5
// subHoldView.layer.borderColor = UIColor(red: 0.798, green: 0.798, blue: 0.798, alpha: 1).cgColor
// subHoldView.backgroundColor = .red
// view.addSubview(subHoldView)
// subHoldView.snp.makeConstraints { make in
// make.top.equalTo(bannerView.snp.bottom).offset(2)
// make.left.equalToSuperview().offset(16)
// make.right.equalToSuperview().offset(-16)
// make.height.equalTo(87)
// }
//
// subHoldView.addSubview(descripeLable)
// descripeLable.snp.makeConstraints { make in
// make.top.equalToSuperview().offset(8)
// make.left.equalToSuperview().offset(8)
// make.right.equalToSuperview().offset(-8)
// make.height.equalTo(30)
// }
//
// subHoldView.addSubview(headImageView)
// headImageView.snp.makeConstraints { make in
// make.top.equalTo(descripeLable.snp.bottom).offset(10)
// make.left.equalTo(descripeLable.snp.left)
// make.height.width.equalTo(25)
// }
//
// subHoldView.addSubview(nameLable)
// nameLable.snp.makeConstraints { make in
// make.top.equalTo(headImageView.snp.top)
// make.left.equalTo(headImageView.snp.right).offset(5)
// make.height.equalTo(12)
// make.width.equalTo(50)
// }
//
// subHoldView.addSubview(dateLable)
// dateLable.snp.makeConstraints { make in
// make.top.equalTo(nameLable.snp.bottom).offset(2)
// make.left.equalTo(nameLable.snp.left)
// make.height.equalTo(12)
// make.right.equalTo(nameLable.snp.right)
// }
//
// subHoldView.addSubview(numLable)
// numLable.snp.makeConstraints { make in
// make.right.equalToSuperview().offset(-8)
// make.height.equalTo(12)
// make.centerY.equalTo(headImageView.snp.centerY)
// }
//
// subHoldView.addSubview(heartImageView)
// heartImageView.snp.makeConstraints { make in
// make.right.equalTo(numLable.snp.left).offset(-6)
// make.height.width.equalTo(12)
// make.centerY.equalTo(headImageView.snp.centerY)
// }
view.addSubview(myCollectView) view.addSubview(myCollectView)
myCollectView.snp.makeConstraints { make in myCollectView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview() make.left.right.bottom.equalToSuperview()
make.top.equalToSuperview().offset(10) make.top.equalToSuperview().offset(10)
} }
// self.myCollectView.backgroundColor = UIColor.green
// self.myCollectView.es.addPullToRefresh {
// self.loadFirstItem()
// }
// self.myCollectView.es.startPullToRefresh()
self.myCollectView.es.addInfiniteScrolling { self.myCollectView.es.addInfiniteScrolling {
self.loadFakeData() self.loadFakeData()
} }
...@@ -256,42 +180,19 @@ extension YHDavidTestViewController: JXSegmentedListContainerViewListDelegate { ...@@ -256,42 +180,19 @@ extension YHDavidTestViewController: JXSegmentedListContainerViewListDelegate {
// MARK: - 滑动使用 // MARK: - 滑动使用
extension YHDavidTestViewController: UIScrollViewDelegate { extension YHDavidTestViewController: UIScrollViewDelegate {
//控制滑动交互 //控制滑动交互
func scrollViewDidScroll(_ scrollView: UIScrollView) { func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView === myCollectView { let scrollViewSet: CGFloat = scrollView.contentOffset.y
let scrollViewSet: CGFloat = scrollView.contentOffset.y if vcCanScroll == false {//不能滚动时
// printLog("subTableView --- scrollView.contentOffset.y = \(scrollViewSet) scrollView.contentOffset.x = \(scrollView.contentOffset.y)") scrollView.contentOffset = CGPoint(x: -20, y: 0)
if vcCanScroll == false {//不能滚动时 } else {
if (scrollViewSet <= 0) {
scrollView.contentOffset = CGPoint(x: -20, y: 0) scrollView.contentOffset = CGPoint(x: -20, y: 0)
vcCanScroll = false
// printLog("vcCanScroll == false") NotificationCenter.default.post(name: Notification.Name(rawValue: "leaveTop"), object: nil)
// self.myParentVc?.listContainerView.scrollView.isScrollEnabled = true
} else { } else {
if (scrollViewSet <= 0) { scrollView.contentOffset = CGPoint(x: -20, y: scrollViewSet)
scrollView.contentOffset = CGPoint(x: -20, y: 0)
vcCanScroll = false
NotificationCenter.default.post(name: Notification.Name(rawValue: "leaveTop"), object: nil)
} else {
scrollView.contentOffset = CGPoint(x: -20, y: scrollViewSet)
}
} }
} }
} }
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
if scrollView === myCollectView {
// printLog("hjl*****开始滚动")
}
}
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if scrollView === myCollectView {
self.myParentVc?.listContainerView.scrollView.isScrollEnabled = true
// printLog("hjl*****停止滚动")
}
}
} }
...@@ -17,7 +17,7 @@ class YHHomeViewController: YHBaseViewController { ...@@ -17,7 +17,7 @@ class YHHomeViewController: YHBaseViewController {
var arrItemVc : [UIViewController] = [] var arrItemVc : [UIViewController] = []
var canScroll : Bool = true var canScroll : Bool = true
var myCellHeight : CGFloat { var myCellHeight : CGFloat {
get { get {
...@@ -87,9 +87,9 @@ class YHHomeViewController: YHBaseViewController { ...@@ -87,9 +87,9 @@ class YHHomeViewController: YHBaseViewController {
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.showsHorizontalScrollIndicator = false tableView.showsHorizontalScrollIndicator = false
tableView.showsVerticalScrollIndicator = false tableView.showsVerticalScrollIndicator = false
// tableView.rowHeight = UITableView.automaticDimension // tableView.rowHeight = UITableView.automaticDimension
// tableView.estimatedRowHeight = 100 // tableView.estimatedRowHeight = 100
// tableView.register(YHHomeCustomCell.self, forCellReuseIdentifier: YHHomeCustomCell.cellReuseIdentifier) // tableView.register(YHHomeCustomCell.self, forCellReuseIdentifier: YHHomeCustomCell.cellReuseIdentifier)
tableView.register(YHDavidCell0.self,forCellReuseIdentifier: YHDavidCell0.cellReuseIdentifier) tableView.register(YHDavidCell0.self,forCellReuseIdentifier: YHDavidCell0.cellReuseIdentifier)
tableView.register(YHDavidCell1.self,forCellReuseIdentifier: YHDavidCell1.cellReuseIdentifier) tableView.register(YHDavidCell1.self,forCellReuseIdentifier: YHDavidCell1.cellReuseIdentifier)
...@@ -124,7 +124,7 @@ class YHHomeViewController: YHBaseViewController { ...@@ -124,7 +124,7 @@ class YHHomeViewController: YHBaseViewController {
// MARK: - 生命周期方法 // MARK: - 生命周期方法
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(leaveTopOp), name:Notification.Name(rawValue: "leaveTop"), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(leaveTopOp), name:Notification.Name(rawValue: "leaveTop"), object: nil)
...@@ -164,9 +164,6 @@ extension YHHomeViewController { ...@@ -164,9 +164,6 @@ extension YHHomeViewController {
canScroll = true canScroll = true
} }
private func requestData() { private func requestData() {
self.homeReqVM.getHomeConfig { flag, error in self.homeReqVM.getHomeConfig { flag, error in
if flag == true { if flag == true {
...@@ -331,9 +328,6 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource { ...@@ -331,9 +328,6 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDavidCell0.cellReuseIdentifier, for: indexPath) as! YHDavidCell0 let cell = tableView.dequeueReusableCell(withIdentifier: YHDavidCell0.cellReuseIdentifier, for: indexPath) as! YHDavidCell0
return cell return cell
} }
let cell = UITableViewCell() let cell = UITableViewCell()
cellView.view.frame = CGRect(x: 0, y: 0, width: cell.contentView.bounds.size.width, height: myCellHeight) cellView.view.frame = CGRect(x: 0, y: 0, width: cell.contentView.bounds.size.width, height: myCellHeight)
cell.contentView.addSubview(cellView.view) cell.contentView.addSubview(cellView.view)
...@@ -347,71 +341,22 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource { ...@@ -347,71 +341,22 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
} }
extension YHHomeViewController: UIScrollViewDelegate { extension YHHomeViewController: UIScrollViewDelegate {
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
print("main - scrollViewWillBeginDragging")
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
print("main - scrollViewDidEndDecelerating")
}
func scrollViewDidScroll(_ scrollView: UIScrollView) { func scrollViewDidScroll(_ scrollView: UIScrollView) {
let bottomCellOffset: CGFloat = homeTableView.rect(forSection: 1).origin.y - 64 + 80 - 12 //48
// if scrollView.isScrollEnabled == false { if (scrollView.contentOffset.y >= bottomCellOffset) {
// printLog("Main scrollView.isScrollEnabled == false") scrollView.contentOffset = CGPointMake(0, bottomCellOffset)
// return if canScroll == true {
// } canScroll = false
//传递参数到 子VC
if scrollView === homeTableView { cellView.canScroll = true
let bottomCellOffset: CGFloat = homeTableView.rect(forSection: 1).origin.y - 64 + 80 - 12 //48
printLog("Main scrollView.contentOffset.y = \(scrollView.contentOffset.y) bottomCellOffset= \(bottomCellOffset)") }
}else{
if (scrollView.contentOffset.y >= bottomCellOffset) { if canScroll == false {
scrollView.contentOffset = CGPointMake(0, bottomCellOffset) scrollView.contentOffset = CGPoint(x: 0, y: bottomCellOffset)
if canScroll == true {
canScroll = false
//传递参数到 子VC
cellView.canScroll = true
}
}else{
if canScroll == false {
scrollView.contentOffset = CGPoint(x: 0, y: bottomCellOffset)
}
} }
self.homeTableView.showsVerticalScrollIndicator = canScroll ? true : false
} }
self.homeTableView.showsVerticalScrollIndicator = false
} }
// func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
//// cellView.segmentedView.selectItemAt(index: 2)
////
//// DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.25) { [weak self] in
//// self?.cellView.listContainerView.scrollView.isScrollEnabled = false
//// }
//
// cellView.listContainerView.scrollView.isScrollEnabled = false
// }
//
// func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
// cellView.listContainerView.scrollView.isScrollEnabled = true
// }
} }
//extension JXSegmentedListContainerView : UIScrollViewDelegate {
// public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
// print("kkkkkkkkk")
// }
//
// public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
// print("jjjjjjj")
// }
//}
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