Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change WKWebView's scroll rate on iOS 9 beta / 9.3

On iOS 8, the below code works fine, it can scroll with more inertia.

webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;

As for iOS 9 beta 3, this code is meaningless, even without an error.
Is this a bug or are there any other ways around?

Note: UIWebView's scroll rate can be changed two types on both versions.

like image 804
Shingo Fukuyama Avatar asked Jul 12 '15 15:07

Shingo Fukuyama


1 Answers

Update: this has been fixed but not deployed in iOS 9.3 (see workaround below). More detail here:

  • https://bugs.webkit.org/show_bug.cgi?id=148086
  • http://trac.webkit.org/changeset/188541/trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm

I had the same issue and it seems to be a bug in iOS 9.

The workaround is to set it in the will begin dragging delegate instead of at the time of instantiation:

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
}
like image 107
Hekod Avatar answered Sep 28 '22 08:09

Hekod