美文网首页
IOS强制退出app

IOS强制退出app

作者: 张威_9cfe | 来源:发表于2019-05-27 18:00 被阅读0次

    - (IBAction)action_OK:(id)sender {

        if(_setRow ==0)

        {

            [[NSUserDefaults standardUserDefaults] setObject:@"zh-Hans"forKey:@"seetongLanguage"];

        }

        elseif(_setRow ==1)

        {

            [[NSUserDefaults standardUserDefaults] setObject:@"vi"forKey:@"seetongLanguage"];

        }

        elseif(_setRow ==2)

        {

            [[NSUserDefaults standardUserDefaults] setObject:@"en"forKey:@"seetongLanguage"];

        }

        [[UserClient shareUserClient]showSuccessView:@"Successfully modify,Please restart APP"];

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

            [[UserClient shareUserClient] dismiss];

            [selfexitApplication];//强制退出程序

        });

    }

    - (void)exitApplication

    {

        UIWindow *window = [UIApplication sharedApplication].delegate.window;

        //退出动画

        [UIView animateWithDuration:1.0fanimations:^{

            window.alpha =0;

            window.frame = CGRectMake(0, window.bounds.size.width,0,0);

        } completion:^(BOOLfinished) {

            exit(0);

        }];

        //exit(0);

    }

    相关文章

      网友评论

          本文标题:IOS强制退出app

          本文链接:https://www.haomeiwen.com/subject/fshktctx.html