Commit f59d9d6a authored by Steven杜宇's avatar Steven杜宇

// 生活详情悬停

parent 041e0ca6
...@@ -115,6 +115,7 @@ class YHHomeIdentityListVC: YHBaseViewController { ...@@ -115,6 +115,7 @@ class YHHomeIdentityListVC: YHBaseViewController {
dataSource.itemWidth = Self.tabWidth dataSource.itemWidth = Self.tabWidth
dataSource.itemSpacing = Self.tabGap dataSource.itemSpacing = Self.tabGap
dataSource.itemWidthSelectedZoomScale = 1.0 dataSource.itemWidthSelectedZoomScale = 1.0
dataSource.isItemSpacingAverageEnabled = false
return dataSource return dataSource
}() }()
......
...@@ -124,13 +124,37 @@ class YHLifeDetailViewController: YHBaseViewController { ...@@ -124,13 +124,37 @@ class YHLifeDetailViewController: YHBaseViewController {
indicator.indicatorColor = .brandMainColor indicator.indicatorColor = .brandMainColor
segmentedView.indicators = [indicator] segmentedView.indicators = [indicator]
segmentedView.defaultSelectedIndex = 0 segmentedView.defaultSelectedIndex = 0
segmentedView.backgroundColor = .white
return segmentedView return segmentedView
}() }()
lazy var topSegmentedView : JXSegmentedView = {
let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 44))
segmentedView.delegate = self
segmentedView.dataSource = segmentedDataSource
//配置指示器
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorHeight = 2
indicator.indicatorCornerRadius = 0.0
indicator.indicatorColor = .brandMainColor
segmentedView.indicators = [indicator]
segmentedView.defaultSelectedIndex = 0
segmentedView.backgroundColor = .white
segmentedView.isHidden = true
return segmentedView
}()
lazy var topLine:UIView = {
let lineView = UIView()
lineView.backgroundColor = .separatorColor
lineView.isHidden = true
return lineView
}()
static let tabWidth = 64.0 static let tabWidth = 64.0
// 默认为4个tab // 默认为4个tab
static let tabGap = (KScreenWidth-20.0*2-tabWidth*4.0)/3.0 static let tabGap = (KScreenWidth-20.0*2-tabWidth*4.0)/3.0
lazy var segmentedDataSource: JXSegmentedTitleDataSource = { lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource() let dataSource = JXSegmentedTitleDataSource()
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 16) dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 16)
...@@ -140,6 +164,7 @@ class YHLifeDetailViewController: YHBaseViewController { ...@@ -140,6 +164,7 @@ class YHLifeDetailViewController: YHBaseViewController {
dataSource.itemWidth = Self.tabWidth dataSource.itemWidth = Self.tabWidth
dataSource.itemSpacing = Self.tabGap dataSource.itemSpacing = Self.tabGap
dataSource.itemWidthSelectedZoomScale = 1.0 dataSource.itemWidthSelectedZoomScale = 1.0
dataSource.isItemSpacingAverageEnabled = false
return dataSource return dataSource
}() }()
...@@ -157,6 +182,8 @@ class YHLifeDetailViewController: YHBaseViewController { ...@@ -157,6 +182,8 @@ class YHLifeDetailViewController: YHBaseViewController {
self.view.backgroundColor = .white self.view.backgroundColor = .white
self.view.addSubview(self.tableView) self.view.addSubview(self.tableView)
self.view.addSubview(self.shareView) self.view.addSubview(self.shareView)
self.view.addSubview(self.topSegmentedView)
self.view.addSubview(self.topLine)
self.view.addSubview(self.navView) self.view.addSubview(self.navView)
self.navView.snp.makeConstraints { make in self.navView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview() make.left.right.top.equalToSuperview()
...@@ -170,6 +197,18 @@ class YHLifeDetailViewController: YHBaseViewController { ...@@ -170,6 +197,18 @@ class YHLifeDetailViewController: YHBaseViewController {
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
make.bottom.equalTo(self.shareView.snp.top) make.bottom.equalTo(self.shareView.snp.top)
} }
let left = 20.0-Self.tabGap
self.topSegmentedView.snp.makeConstraints { make in
make.left.equalTo(left)
make.right.equalTo(-left)
make.height.equalTo(44)
make.top.equalTo(self.navView.snp.bottom)
}
self.topLine.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.height.equalTo(1.0)
make.top.equalTo(self.topSegmentedView.snp.bottom)
}
} }
} }
...@@ -185,8 +224,12 @@ extension YHLifeDetailViewController: UIScrollViewDelegate { ...@@ -185,8 +224,12 @@ extension YHLifeDetailViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) { func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView.contentOffset.y >= (Self.headerHeight-k_Height_NavigationtBarAndStatuBar-45.0) { if scrollView.contentOffset.y >= (Self.headerHeight-k_Height_NavigationtBarAndStatuBar-45.0) {
navView.isHidden = false navView.isHidden = false
topSegmentedView.isHidden = false
topLine.isHidden = false
} else { } else {
navView.isHidden = true navView.isHidden = true
topSegmentedView.isHidden = true
topLine.isHidden = 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