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

how to set navigationbar height contains statusbar height when pull down #62

Open
jjy4880 opened this issue Jul 17, 2019 · 2 comments
Open

Comments

@jjy4880
Copy link

jjy4880 commented Jul 17, 2019

..

@jjy4880 jjy4880 changed the title Q. How to Cover iPhoneX, Xs... Statusbar. plz how to set navigationbar height contains statusbar height when pull down Jul 17, 2019
@pongponglau
Copy link

I encounter the same issue. May i ask if there is any solution?

Many thanks

@ZXCheng
Copy link

ZXCheng commented Jul 8, 2020

`extension PullToDismiss: UIScrollViewDelegate {
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
if dragging {
let diff = -(scrollView.contentOffset.y - previousContentOffsetY)
if #available(iOS 11.0, *) {
if scrollView.contentOffset.y < -scrollView.adjustedContentInset.top || (targetViewController?.view.frame.origin.y ?? 0.0) > 0.0 {
updateViewPosition(offset: diff)
scrollView.contentOffset.y = -scrollView.adjustedContentInset.top
}
} else {
if scrollView.contentOffset.y < -scrollView.contentInset.top || (targetViewController?.view.frame.origin.y ?? 0.0) > 0.0 {
updateViewPosition(offset: diff)
scrollView.contentOffset.y = -scrollView.contentInset.top
}
}
previousContentOffsetY = scrollView.contentOffset.y
}
}

public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
    startDragging()
    dragging = true
    previousContentOffsetY = scrollView.contentOffset.y
}

public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
    finishDragging(withVelocity: velocity)
    dragging = false
    previousContentOffsetY = 0.0
}

}`

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

3 participants