ios应用通常是不建议做退出操作的,因为直接home键就可以搞定,符合乔布斯简洁的思路。
下面是我看到别人退出应用的一种做法,Mark一下
- (
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:UIViewAnimationCurveEaseOut forView:
self
.window cache:
NO
];
[UIView setAnimationDidStopSelector:
@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);
}
}
最关键的是exit(0),但是如果只做exit(0),效果和闪退差不多,非常难看,所以人家做了一个动画。
http://www.cnblogs.com/wanyakun/p/3492675.html
上面是人家的博客。
本人自建的一个iOS交流群165332140,欢迎各位大神进群交流指导。