NSButton 的 #selector(ViewController.backBtnClicked) 不适用于蒙特雷

发布于 2025-01-15 08:24:43 字数 632 浏览 1 评论 0原文

所以我有一个 WKWebView &其顶部有一个 NSButton,其

backBtn = NSButton(image: NSImage(named: "NSLeftFacingTriangleTemplate")!, target: self, action: #selector(ViewController.backBtnClicked))

函数定义为

@objc func backBtnClicked(){}

This is for Swift MacOS app。

所有这一切都运行良好,直到蒙特利进行新升级。现在,WKWebView 在其中打开一个 PDF 以及其顶部的按钮。该按钮在加载 HTML 的其他视图中工作正常。它似乎不适用于 PDF 文件。

当您将鼠标悬停在 PDF 页面底部时,WKWebView 会出现此类选项,例如缩放或下载。 我的想法是,这些选项正在取代按钮点击,而蒙特利之前的情况并非如此。 所以我的问题是,

  • 这是否是一个已知的错误,或者
  • 是否有任何解决方法,或者
  • WKWebView 是否有任何设置选项,以便我可以在其中打开 PDF 文件时禁用这些选项

So I have a WKWebView & a NSButton on top of it with a

backBtn = NSButton(image: NSImage(named: "NSLeftFacingTriangleTemplate")!, target: self, action: #selector(ViewController.backBtnClicked))

with the function defined as

@objc func backBtnClicked(){}

This is for Swift MacOS app.

All of this was working fine until the new upgrade of Monterey. Now WKWebView opens a PDF in it and the button on top of it. The button works fine in other views that load HTML. It just does not seem to work with the PDF files.

WKWebView such options when you hover on the PDF towards bottom of page such as zoom or download. What I am thinking is that those options are overtaking the button click which was not the case before Monterey.
So my question is if

  • this is a known bug or
  • if there is any workaround or
  • if there is any setting option with WKWebView so that I can disable those option when a PDF file opens in it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文