我試圖禁用出現在我的應用程式 mac 視窗上的全屏按鈕(綠色按鈕)(最初它是一個 iOS 應用程式,我通過 Xcode - Mac Catalyst 功能中的應用程式設定使其可用于 macOS),在 AppDelegate 中使用如下代碼.swift,但它不起作用,因為我使用的是 UIKit 而不是 AppKit:
for window in NSApplication.shared.windows {
if let zoomButton = window.standardWindowButton(NSWindow.ButtonType.zoomButton) {
zoomButton.isHidden = true;
}
}
有誰知道如何使用 UIKit 庫禁用全屏按鈕?
請注意,我使用 Ionic 框架構建了一個 iOS 應用程式,我想讓它可用于 macOS,我所做的是在 Xcode 上的應用程式設定中啟用 macOS 版本,因此我僅在 Xcode 上使用 AppDelegate.swift 檔案。
uj5u.com熱心網友回復:
我發現了如何通過創建 macOS 捆綁目標和 Helper 類來使用和包含 AppKit API,然后禁用 didFinishLaunchingWithOptions 方法上的縮放按鈕。
對于在啟用 Mac Catalyst 時遇到此問題的任何人,請按照以下鏈接中的步驟操作:
https://crunchybagel.com/disabling-the-mac-zoom-maximise-button-in-catalyst/
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/484318.html
