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

Problem getting contentInset from RefreshView. #34

Open
HyunjoonKo opened this issue Dec 18, 2019 · 0 comments
Open

Problem getting contentInset from RefreshView. #34

HyunjoonKo opened this issue Dec 18, 2019 · 0 comments

Comments

@HyunjoonKo
Copy link

In the case of the contentInsetTop and contentInsetBottom variables of RefreshView, the value of contentInset and the value of adjustedContentInset are added.

However, this results in the same result as multiplying contentInset twice.
Because the value of adjustedContentInset is contentInset plus the value of safeArea.

The following fixes the problem where the scroll view is strange after refreshing or the value of contentOffset that is necessary for refreshing is too large:

private extension UIScrollView {
    var contentInsetTop: CGFloat {
        if #available(iOS 11.0, *) {
            return adjustedContentInset.top
        } else {
            return contentInset.top
        }

        return contentInset.top
    }

    var contentInsetBottom: CGFloat {
        if #available(iOS 11.0, *) {
            return adjustedContentInset.bottom
        } else {
            return contentInset.bottom
        }
    }
}
closure11 added a commit to closure11/SwiftPullToRefresh that referenced this issue Dec 30, 2019
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

1 participant