//退出应用
– (void)appExit{
UIButton *but = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 100, 30)];
[but setTitle:@”退出此应用“ forState:UIControlStateNormal];
[but setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
[self.view addSubview:but];
[but addTarget:self action:@selector(didClicked:) forControlEvents:UIControlEventTouchUpInside];
}
– (void)didClicked:(id)sender{
[UIView beginAnimations:@”exitApplication” context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view.window cache:NO];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
self.view.window.bounds = CGRectMake(0, 0, 0, 0);
[UIView commitAnimations];
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/3325.html