-(void)animationFinished:(NSString*)animationid finished:(NSNumber*)finished
context:(void*)context
{
if ([animationid compare:@"exitApplication"]==0) {
exit(0);// 退出应用程序
NSLog(@"stop");
}
}
-(IBAction)exit:(id)sender
{
[UIViewbeginAnimations:@"exitApplication"context:nil]; //动画名称
[UIViewsetAnimationDuration:6];
[UIViewsetAnimationDelegate:self];
[UIViewsetAnimationTransition:UIViewAnimationCurveEaseInOutforView:self.viewcache:NO]; // 动画方式
//动画结束执行的操作
[UIVie setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
self.view.bounds=CGRectMake(0,0, 0, 0);//动画结束
[UIViewcommitAnimations];
}
本文介绍了如何在iOS应用中使用动画效果优雅地退出程序。通过`UIView`的动画方法设置动画持续时间、曲线和结束回调,然后在动画完成时调用`exit(0)`来关闭应用程序。
1029

被折叠的 条评论
为什么被折叠?



