简体   繁体   English

无法在iOS 9 beta / 9.3上更改WKWebView的滚动速率

[英]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. 在iOS 8上,下面的代码工作正常,它可以滚动更多的惯性。

webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;

As for iOS 9 beta 3, this code is meaningless, even without an error. 至于iOS 9 beta 3,即使没有错误,这段代码也毫无意义。
Is this a bug or are there any other ways around? 这是一个错误还是有其他方法吗?

Note: UIWebView's scroll rate can be changed two types on both versions. 注意:UIWebView的滚动速率可以在两个版本上更改两种类型。

Update: this has been fixed but not deployed in iOS 9.3 (see workaround below). 更新:这已得到修复,但未在iOS 9.3中部署(请参阅下面的解决方法)。 More detail here: 更多细节在这里:


I had the same issue and it seems to be a bug in iOS 9. 我有同样的问题,它似乎是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;
}

I also used to get sporadic crashes, then I set 我也经常发生零星的崩溃,然后我就设置了

webview.scrollView.delegate = nil 

in deinit. 在deinit。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM