iOS通过代码关闭程序

//-------------------------------- 退出程序 -----------------------------------------//

- (void)exitApplication {

[UIView beginAnimations:@"exitApplication" context:nil];

[UIView setAnimationDuration:0.5];

[UIView setAnimationDelegate:self];

// [UIView setAnimationTransition:UIViewAnimationCurveEaseOut forView:self.view.window cache:NO];

[UIView setAnimationTransition:UIViewAnimationCurveEaseOutforView:self.window cache:NO];

[UIViewsetAnimationDidStopSelector:@selector(animationFinished:finished:context:)];

//self.view.window.bounds = CGRectMake(0, 0, 0, 0);

self.window.bounds = CGRectMake(0, 0, 0, 0);

[UIView commitAnimations];

}

- (void)animationFinished:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {

if ([animationID compare:@"exitApplication"] == 0) {

exit(0);

}

}

上一篇:k8s重要概念


下一篇:【iOS-cocos2d-X 游戏开发之四】Cocos2dX创建Android NDK新项目并编译导入Eclipse中正常运行!