在macOS中禁用WKWebview的跳动滚动 [英] Disable bounce scrolling for WKWebview in macOS
问题描述
试图在macOS中为WKWebview禁用跳动滚动, 但是macOS中的WKWebview没有"scrollView"
Trying to disable bounce scrolling for WKWebview in macOS, but WKWebview in macOS has no "scrollView"
let webView = WKWebView(frame: view.frame)
print(webView.scrollView)
推荐答案
关于这一点,您可能注意到或未注意到的一件非常奇怪的事情是,在WKWebView类中,有一个对scrollView的描述,从理论上讲,它是假定的". "添加到该类中,但scrollView不存在.可以在下面的照片中看到:
One really weird thing about this that you may or may not have noticed is that in the WKWebView class, there is a description of the scrollView that is theoretically "supposed" to be in the class, but the scrollView is not there. This can be seen in the photo below:
我会说这可能是Apple的一个怪异过程,但是在iOS类中,出现了相同的描述,但这次有一个实际的scrollView:
I would say that it could be a weird procedure of Apple's, but see in the iOS class, the same description is present but with an actual scrollView this time:
除非我在这里缺少一些重要的东西,否则可能意味着以下两件事之一:
Unless I am missing something major here, this would likely mean one of two things:
- 应该有一个scrollView但没有(即它被Apple意外删除了??)
- scrollView已从macOS WKWebView中删除,但是描述被意外地留在了类中?
无论哪种方式,这都是一个非常奇怪的发现.
Either way this is a very weird finding.
您可能要考虑对此做进一步的研究,也许提交Swift错误报告.
You might want to consider doing some further research on this, and perhaps filing a Swift bug report.
有人向我指出,此滚动视图实际上是仅iOS的属性,而不必要的注释是bug.
It was pointed out to me that this scroll view is in-fact a iOS only property, and the unnecessary comment is the bug.
这篇关于在macOS中禁用WKWebview的跳动滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!