I am running a WkWebView
which is rendering my web content in my app. However when I am scrolling at the top/bottom of the page (vertically) the page bounces like a normal web page and I am losing the native User experience.
I have done some research on this topic which apperantly is a pretty common issue But non of the answeres resolved my problem.
What most people suggest is to use the following: wkWebView.scrollView.bounces = false
. But for some reason it has no affect in my webView at all.
Help anyone?
i.e. I prefer solving the issue with native swift rather then injecting js etc..
This is work for me:
wKWebView.scrollView.bounces = false
for me, it works when I set these two:
webView.scrollView.alwaysBounceVertical = false
webView.scrollView.bounces = false
but some H5 still bouncing, I guess it's the situation caused by the website itself.
This may be a problem with where you are doing this. This does not work when executed in the LoadView
function. This only works if it is run in the ViewDidLoad
function.
override func viewDidLoad() {
super.viewDidLoad()
mainWebView.scrollView.bounces = false
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With