Jquery Sage
Jquery Sage

Reputation: 1113

Terminate application on exit

how could i make my Xcode application terminate completely when the user presses the X button.

Could you also provide some detail cause i'm sort of a beginner.

EDIT: Sorry for my vagueness, This is a desktop application.

Upvotes: 1

Views: 658

Answers (2)

NSResponder
NSResponder

Reputation: 16861

Send the following message: [NSApp terminate:nil].

Upvotes: 0

VenoMKO
VenoMKO

Reputation: 3294

Use - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender method of AppDelegate. Sample:

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

Upvotes: 5

Related Questions