Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

头部高度变化如何更新 #4

Closed
LucioLee opened this issue Oct 15, 2019 · 5 comments
Closed

头部高度变化如何更新 #4

LucioLee opened this issue Oct 15, 2019 · 5 comments

Comments

@LucioLee
Copy link

LucioLee commented Oct 15, 2019

HeaderView的高度会随着操作发送变化,怎么动画顺滑地更新高度?

@LucioLee LucioLee reopened this Oct 15, 2019
@bawn
Copy link
Owner

bawn commented Oct 15, 2019

简单一点在 AquamanPageViewController.swift 中添加一个方法

 public func updateHeaderView() {
        headerViewHeight = headerViewHeightFor(self)
        headerViewConstraint?.constant = headerViewHeight
    }

然后

override func pageController(_ pageController: AquamanPageViewController, mainScrollViewDidScroll scrollView: UIScrollView) {
        print(scrollView.contentOffset)
        headerViewHeight -= scrollView.contentOffset.y
        updateHeaderView()
    }

不过你需要考虑的是 scrollView.contentOffset 同时也在变化

@LucioLee
Copy link
Author

多谢!已经解决,只是希望从库的层面提供支持,不想改库
image

@LucioLee
Copy link
Author

LucioLee commented Oct 15, 2019

还有一个问题,menuViewPinHeight这个参数我理解上应该是对menuView吸附效果做一个附加偏移,我看Demo中这个值传了一个导航栏的高度,能不能在库里实现对safeArea的适配?

@bawn
Copy link
Owner

bawn commented Oct 15, 2019

谢谢你的意见,后续我会考虑优化

@bawn bawn closed this as completed in 5326cc1 Oct 18, 2019
@bawn
Copy link
Owner

bawn commented Jan 9, 2020

@LucioLee

还有一个问题,menuViewPinHeight这个参数我理解上应该是对menuView吸附效果做一个附加偏移,我看Demo中这个值传了一个导航栏的高度,能不能在库里实现对safeArea的适配?

已经实现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants