5
votes

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

1
I always try to incorporate solutions for "worst-case-resolutions". For example if put your layout in some sort of scrollable pane you make sure that people can use your application, even if their displays have "exotic" resolutionsdas_weezul

1 Answers

26
votes

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;
}