Cannot change WKWebView's scroll rate on iOS 9

2019-02-07 03:33发布

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.

2条回答
姐就是有狂的资本
2楼-- · 2019-02-07 03:36

I also used to get sporadic crashes, then I set

webview.scrollView.delegate = nil 

in deinit.

查看更多
欢心
3楼-- · 2019-02-07 04:00

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


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;
}
查看更多
登录 后发表回答