Home > other >  How to disable fullscreen button in macOS app (Mac Catalyst)
How to disable fullscreen button in macOS app (Mac Catalyst)

Time:05-31

I tried to disable the fullscreen button (green button) that appears on my app mac window (originally it's an iOS app and I made it available for macOS through the app setting in Xcode - Mac Catalyst feature) using a code like the below in AppDelegate.swift, but it's not working because I am using UIKit not AppKit:

for window in NSApplication.shared.windows {
    if let zoomButton = window.standardWindowButton(NSWindow.ButtonType.zoomButton) {
        zoomButton.isHidden = true;
    }
}

Does anyone have any idea how to disable the fullscreen button using the UIKit library?

Please note that I built an iOS app using an Ionic framework and I want to make it available for macOS, what I did is enable the macOS version on the app setting on the Xcode, so I am using AppDelegate.swift file only on Xcode.

CodePudding user response:

I found how to do it by creating a macOS bundle target and Helper class to use and include AppKit API, then disabling the zoom button on the didFinishLaunchingWithOptions method.

For anyone who faces this issue when enabling Mac Catalyst, please follow the steps on below link:

https://crunchybagel.com/disabling-the-mac-zoom-maximise-button-in-catalyst/

  • Related