iOS 动画退出应用代码详解手机开发

//退出应用

– (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

(0)
上一篇 2021年7月16日
下一篇 2021年7月16日

相关推荐

发表回复

登录后才能评论