当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: