Disable bounce scrolling for WKWebview in macOS

百般思念 提交于 2019-12-10 18:28:48

问题


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)

回答1:


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:

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:

  1. There should be a scrollView but there isn't (i.e. it was accidentally deleted by Apple???)
  2. The scrollView was removed from the macOS WKWebView, but the description was accidentally left in the class?

Either way this is a very weird finding.

You might want to consider doing some further research on this, and perhaps filing a Swift bug report.

EDIT:

It was pointed out to me that this scroll view is in-fact a iOS only property, and the unnecessary comment is the bug.



来源:https://stackoverflow.com/questions/39929552/disable-bounce-scrolling-for-wkwebview-in-macos

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