简体   繁体   中英

Minimum window size of a Mac OS X application

Two questions here.

First question, In my Mac OS X application the window has resizing enabled. My window contents are on a 500x500 window size. Problem is that user can resize it so some of the contents cutts off. What I need to do so user can only resize to a minimum size (In my case 500x500)?

Second question, When I close my Mac application (by clicking red cross button on window top) the app icon stays in the dock at the bottom. When user click on it again it does not fire up the application unless user quit the application all togeter and relaunches it again. What settings do I need so user can close and relaunch it by clicking dock icon?

Thanks

Use -[NSWindow setMinSize:] to set the minimum size programmatically, but you can also set the minimum size inside Interface Builder (look at the tab with the sizes).

To make the application quit when the window is closed, you need to add this to your app delegate:

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
    return YES;
}

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