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

ScrollView sometimes doesn't get back to it's default position. #311

Open
heruvilius opened this issue Apr 9, 2018 · 10 comments
Open

ScrollView sometimes doesn't get back to it's default position. #311

heruvilius opened this issue Apr 9, 2018 · 10 comments

Comments

@heruvilius
Copy link

Hello.

Am am using this framework with WKWebView to minimize Navigation Bar when scrolling downwards. I am facing a problem when Navigation Bar has its full height, but my web view is offset as if the bar has its small height.

Here is the video, where everything works fine.
And here is the video, where the behaviour is undesired.

To use the framework I've added the following lines into View Controller that manages WKWebView:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    // My other code 
    // ...
    guard let navigator = navigationController as? ScrollingNavigationController else { return }
    navigator.followScrollView(webView.scrollView, delay: 55.0)
}
override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    guard let navigator = navigationController as? ScrollingNavigationController else { return }
    navigator.stopFollowingScrollView()
}

webView is a UIView that has WKWebView instance inside its view hierarchy, as well as some other views. It's scrollView property simply returns WKWebView instance's scrollView property.

@sbelmeha
Copy link

+1

1 similar comment
@xgoo
Copy link

xgoo commented Apr 11, 2018

+1

@andreamazz
Copy link
Owner

andreamazz commented Apr 11, 2018

@landsv @xgoo either provide constructive feedback or avoid meaningless +1, GH reactions were implemented for a reason.
Bugging me with a notification is not going to help me fix the issue.
Thanks

@andreamazz
Copy link
Owner

@heruvilius
I'm not sure I fully understand what you mean. Sometimes it works and sometimes it doesn't?
I'd advise against following the webview's scrollview, since the library already does that internally.

@heruvilius
Copy link
Author

@andreamazz "Sometimes it works and sometimes it doesn't?" - yes, that's exactly what is happening.
"I'd advise against following the webview's scrollview, since the library already does that internally." - so I should follow the webView itself instead?

@andreamazz
Copy link
Owner

I should follow the webView itself instead?

Exactly

@heruvilius
Copy link
Author

@andreamazz the problem still persists. Maybe the issue is my view hierarchy? I shall describe it again.

MyViewController:
    - UINavigationBar
    - UIView:
        -- WKWebView
        -- UIView
        -- UIView
    - UIToolbar

@sbelmeha
Copy link

sbelmeha commented Apr 11, 2018

Looks like contentInset and scrollIndicatorInsets should be reseted as it's done with contentOffset. At least it resolved my case.

@andreamazz
Copy link
Owner

Looks like contentInset and scrollIndicatorInsets should be reseted as it's done with contentOffset. At least it resolved my case.

Where did you reset the insets?
The contentOffset is reset in case of a translucent navbar, it doesn't seem @heruvilius' case, judging by the videos above.

@neaped
Copy link

neaped commented Jul 2, 2018

@andreamazz same with #238 ?

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

No branches or pull requests

5 participants