iPhone SDK退出

时间:2010-01-29 03:28:20

标签: iphone iphone-sdk-3.0

我找到了许多应用程序,你可以按下按钮或类似的东西,应用程序将终止并带你回到主屏幕。我该怎么做?

2 个答案:

答案 0 :(得分:1)

出口(0);

这可以退出应用程序。

再次,我认为最好的方式如下:

    //@step invoke the normal routine applicationWillTerminate
if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(applicationWillTerminate:)]) 
{
    [[UIApplication sharedApplication].delegate performSelector:@selector(applicationWillTerminate:) withObject:[UIApplication sharedApplication]];
}
//@step force quite app
kill(getpid(), SIGINT); 

我从溢出的其他帖子中得到了它:D

答案 1 :(得分:0)

来自http://www.iphonedevsdk.com/forum/iphone-sdk-development/6928-exit-application.html

[[UIApplication sharedApplication] terminateWithSuccess];