简体   繁体   English

退出时终止申请

[英]Terminate application on exit

how could i make my Xcode application terminate completely when the user presses the X button. 当用户按下X按钮时,我如何使我的Xcode应用程序完全终止。

Could you also provide some detail cause i'm sort of a beginner. 您还可以提供一些详细信息吗,因为我有点初学者。

EDIT: Sorry for my vagueness, This is a desktop application. 编辑:对不起,我的含糊不清,这是一个桌面应用程序。

Use - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender method of AppDelegate. 使用- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender AppDelegate的- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender方法。 Sample: 样品:

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

发送以下消息: [NSApp terminate:nil]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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