IT虾米网

iOS 动画退出应用代码详解

flyfish 2018年06月23日 手机开发 424 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身份证验证详解
你是第一个吃螃蟹的人
发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。