Commit 97b8603c authored by Steven杜宇's avatar Steven杜宇

// 滚动显示底部控件

parent 0f18024e
...@@ -27,6 +27,8 @@ class YHHomeIdentityItem { ...@@ -27,6 +27,8 @@ class YHHomeIdentityItem {
class YHHomeIdentityViewController: YHBaseViewController { class YHHomeIdentityViewController: YHBaseViewController {
var scrollContentY: CGFloat = 0.0
var isShowBottomView: Bool = false
var imgItems:[YHHomeIdentityItem] = [YHHomeIdentityItem(img:UIImage(named: "identity_talent_1")), var imgItems:[YHHomeIdentityItem] = [YHHomeIdentityItem(img:UIImage(named: "identity_talent_1")),
YHHomeIdentityItem(img:UIImage(named: "identity_talent_2")), YHHomeIdentityItem(img:UIImage(named: "identity_talent_2")),
YHHomeIdentityItem(img:UIImage(named: "identity_talent_3")), YHHomeIdentityItem(img:UIImage(named: "identity_talent_3")),
...@@ -60,6 +62,7 @@ class YHHomeIdentityViewController: YHBaseViewController { ...@@ -60,6 +62,7 @@ class YHHomeIdentityViewController: YHBaseViewController {
tableView.register(YHHomeIdentityCell.self, forCellReuseIdentifier: YHHomeIdentityCell.cellReuseIdentifier) tableView.register(YHHomeIdentityCell.self, forCellReuseIdentifier: YHHomeIdentityCell.cellReuseIdentifier)
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
tableView.bounces = false
tableView.tableHeaderView = self.headerView tableView.tableHeaderView = self.headerView
return tableView return tableView
}() }()
...@@ -148,16 +151,6 @@ class YHHomeIdentityViewController: YHBaseViewController { ...@@ -148,16 +151,6 @@ class YHHomeIdentityViewController: YHBaseViewController {
make.top.equalTo(headImgView.snp.bottom).offset(8.0) make.top.equalTo(headImgView.snp.bottom).offset(8.0)
} }
} }
func scrollViewDidScroll(_ scrollView: UIScrollView) {
printLog("offset: \(scrollView.contentOffset.y)")
if scrollView.contentOffset.y <= self.headerView.height {
if self.segmentedView.selectedIndex != 0 {
self.segmentedView.defaultSelectedIndex = 0
self.segmentedView.reloadDataWithoutListContainer()
}
}
}
} }
extension YHHomeIdentityViewController: JXSegmentedViewDelegate { extension YHHomeIdentityViewController: JXSegmentedViewDelegate {
...@@ -212,6 +205,44 @@ extension YHHomeIdentityViewController: UITableViewDataSource, UITableViewDelega ...@@ -212,6 +205,44 @@ extension YHHomeIdentityViewController: UITableViewDataSource, UITableViewDelega
} }
} }
extension YHHomeIdentityViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
printLog("offset: \(scrollView.contentOffset.y)")
if scrollView.contentOffset.y <= self.headerView.height {
if self.segmentedView.selectedIndex != 0 {
self.segmentedView.defaultSelectedIndex = 0
self.segmentedView.reloadDataWithoutListContainer()
}
}
let gap = 10.0
if scrollView.contentOffset.y >= self.scrollContentY+gap {
self.scrollContentY = scrollView.contentOffset.y
if !self.isShowBottomView {
self.isShowBottomView = true
printLog("ABC show: \(self.scrollContentY)")
var model = TabBarShareModel()
model.showFlag = true
model.shareUrl = ""
model.codeUrl = ""
model.downloadUrl = ""
NotificationCenter.default.post(name: YhConstant.YhNotification.changeShareViewStatusOnTabBarNotifiction, object: model)
}
} else if scrollView.contentOffset.y <= self.scrollContentY-gap {
self.scrollContentY = scrollView.contentOffset.y
if self.isShowBottomView {
self.isShowBottomView = false
printLog("ABC hide: \(self.scrollContentY)")
var model = TabBarShareModel()
model.showFlag = false
NotificationCenter.default.post(name: YhConstant.YhNotification.changeShareViewStatusOnTabBarNotifiction, object: model)
}
}
}
}
extension YHHomeIdentityViewController { extension YHHomeIdentityViewController {
func requestData() { func requestData() {
......
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