zoukankan      html  css  js  c++  java
  • 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:UIViewAnimationTransitionCurlDown forView:self.view cache:NO];
        
        [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
        
        //self.view.window.bounds = CGRectMake(0, 0, 0, 0);
        
        self.view.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);
  • 相关阅读:
    提升树在回归方法中的应用
    前向分布算法
    提升树
    AdaBoost算法学习笔记
    统计学习方法-提升方法
    序列最小最优化算法
    mysql-profiling详解
    mysql,简单介绍一下索引
    MySQL Explain详解
    spring的事务传播行为
  • 原文地址:https://www.cnblogs.com/lixiong-iOS/p/3626058.html
Copyright © 2011-2022 走看看