开发者

iPhone SDK Quitting

开发者 https://www.devze.com 2022-12-18 05:50 出处:网络
I have found many apps where you can press a button or something similar and the application will terminate an开发者_如何学编程d bring you back to the home screen. How would I do this?exit(0);

I have found many apps where you can press a button or something similar and the application will terminate an开发者_如何学编程d bring you back to the home screen. How would I do this?


exit(0);

this can exit the app .

again, the best way I think will be like as follows:

    //@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); 

I got it from other post on the overflow :D


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

[[UIApplication sharedApplication] terminateWithSuccess];
0

精彩评论

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