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

隐身守侯 提交于 2019-12-18 13:30:04

问题


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.


回答1:


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;
}



回答2:


I also used to get sporadic crashes, then I set

webview.scrollView.delegate = nil 

in deinit.



来源:https://stackoverflow.com/questions/31369538/cannot-change-wkwebviews-scroll-rate-on-ios-9-beta-9-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!