简体   繁体   中英

How can I remove the resize corner from an NSPanel that is an HUD Window

I'm trying to remove the resize corner from an NSPanel HUD styles.

This is what I'm trying right now.

NSUInteger currentStyleMask = [somePanel styleMask]; [somePanel setStyleMask: currentStyleMask | !NSResizableWindowMask];

I also get a warning that NSWindow may not respond to setStyleMask and it isn't defined in NSWindow.h, however it is defined in the NSWindow documentation.

You can only set the style mask of an NSWindow at creation time, you can't change it once the window has been instantiated.

You need to create the window programmatically and initialize it by calling -initWithContentRect:styleMask:backing:defer: and pass in your desired style mask.

If you want to manipulate the window in Interface Builder instead of creating it programmatically, you'll need to subclass NSWindow , override -initWithContentRect:styleMask:backing:defer: and pass in your style mask to super 's implementation. You can then assign your subclass to the window in Interface Builder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM