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

// 刷新组件

parent 5857ba09
...@@ -146,7 +146,7 @@ private extension YHHomePageViewController { ...@@ -146,7 +146,7 @@ private extension YHHomePageViewController {
view.addSubview(homeCollectView) view.addSubview(homeCollectView)
homeCollectView.snp.makeConstraints { make in homeCollectView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.top.equalTo(searchView.snp.bottom).offset(6) make.top.equalTo(searchView.snp.bottom).offset(6+20)
make.bottom.equalToSuperview().offset(-k_Height_TabBar) make.bottom.equalToSuperview().offset(-k_Height_TabBar)
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import UIKit import UIKit
class YHHomeHeadView: UIView { class YHHomeHeadView: UIView {
static let viewH : CGFloat = (20 + YHHomeBannerView.viewH) + (20 + YHHkLifeAndIdView.viewH) + (20 + YHHomeKingKongBlockView.viewH) + 20 + 20 + 1 static let viewH : CGFloat = (YHHomeBannerView.viewH) + (20 + YHHkLifeAndIdView.viewH) + (20 + YHHomeKingKongBlockView.viewH) + 20 + 20 + 1
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
...@@ -44,7 +44,7 @@ private extension YHHomeHeadView { ...@@ -44,7 +44,7 @@ private extension YHHomeHeadView {
addSubview(homeBannerView) addSubview(homeBannerView)
homeBannerView.snp.makeConstraints { make in homeBannerView.snp.makeConstraints { make in
make.top.equalTo(20) make.top.equalTo(0)
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.height.equalTo(YHHomeBannerView.viewH) make.height.equalTo(YHHomeBannerView.viewH)
} }
......
...@@ -22,6 +22,11 @@ class YHRefreshHeaderAnimator: UIView , ESRefreshProtocol, ESRefreshAnimatorProt ...@@ -22,6 +22,11 @@ class YHRefreshHeaderAnimator: UIView , ESRefreshProtocol, ESRefreshAnimatorProt
static let logoWidth = 62.0 static let logoWidth = 62.0
static let logoHeight = 23.0 static let logoHeight = 23.0
static let tipsHeight = 18.0
static let topMargin = 17.0
static let bottomMargin = 19.0
static let midGap = 4.0
static let headerHeight = YHRefreshHeaderAnimator.topMargin + YHRefreshHeaderAnimator.logoHeight + YHRefreshHeaderAnimator.midGap + YHRefreshHeaderAnimator.tipsHeight + YHRefreshHeaderAnimator.bottomMargin
open var pullToRefreshDescription = "下拉刷新".local { open var pullToRefreshDescription = "下拉刷新".local {
didSet { didSet {
...@@ -35,8 +40,8 @@ class YHRefreshHeaderAnimator: UIView , ESRefreshProtocol, ESRefreshAnimatorProt ...@@ -35,8 +40,8 @@ class YHRefreshHeaderAnimator: UIView , ESRefreshProtocol, ESRefreshAnimatorProt
open var view: UIView { return self } open var view: UIView { return self }
open var insets: UIEdgeInsets = UIEdgeInsets.zero open var insets: UIEdgeInsets = UIEdgeInsets.zero
open var trigger: CGFloat = 64.0 open var trigger: CGFloat = YHRefreshHeaderAnimator.headerHeight
open var executeIncremental: CGFloat = 64.0 open var executeIncremental: CGFloat = YHRefreshHeaderAnimator.headerHeight
open var state: ESRefreshViewState = .pullToRefresh open var state: ESRefreshViewState = .pullToRefresh
fileprivate let logoImgView: UIImageView = { fileprivate let logoImgView: UIImageView = {
...@@ -124,10 +129,10 @@ class YHRefreshHeaderAnimator: UIView , ESRefreshProtocol, ESRefreshAnimatorProt ...@@ -124,10 +129,10 @@ class YHRefreshHeaderAnimator: UIView , ESRefreshProtocol, ESRefreshAnimatorProt
UIView.performWithoutAnimation { UIView.performWithoutAnimation {
titleLabel.sizeToFit() titleLabel.sizeToFit()
logoImgView.frame = CGRect.init(x: 0, y: 0, width: Self.logoWidth, height: Self.logoHeight) logoImgView.frame = CGRect.init(x: 0, y: Self.topMargin, width: Self.logoWidth, height: Self.logoHeight)
logoImgView.center = CGPoint.init(x: w / 2.0, y: Self.logoHeight / 2.0) logoImgView.center = CGPoint.init(x: w / 2.0, y: Self.topMargin+Self.logoHeight / 2.0)
animaitonImgView.frame = logoImgView.frame animaitonImgView.frame = logoImgView.frame
titleLabel.center = CGPoint.init(x: w / 2.0, y: logoImgView.frame.maxY+4+9) titleLabel.center = CGPoint.init(x: w / 2.0, y: logoImgView.frame.maxY + Self.midGap + Self.tipsHeight/2.0)
} }
} }
......
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