IT虾米网

iOS 动画退出应用代码

flyfish 2018年06月23日 手机开发 970 0


//退出应用

- (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];

}


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!

iOS身份证验证