开发者

How to stop the termination of the application

I know that my question perhaps sound's a bit confusing, but I wan't to stop the terminating of a Cocoa Mac Os X application. I don't know if there is an API to that. And I also don't know how to do that.

My idea was to call an NSAlert inside the applicationWillTerminate: method. But that doesn't stop the termination of the App.

Another possibility would be to use a while loop, which doesn't stop, but this isn开发者_如何学编程't any good practice, because it uses a lot of CPU and doesn't add any possibility of keeping the rest of the app running.

Please give me an idea, how I could solve this problem.

Much times thanks. =D


Implement the application delegate method applicationShouldTerminate:. Return either NSTerminateCancel or NSTerminateLater. If you return NSTerminateLater then you should eventually call replyToApplicationShouldTerminate: with your final answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜