2012年7月16日,UIViewAnimation


UIView *fromView, *toView; if ([self.frontView superview] != nil) { fromView = self.frontView; toView = self.backView; NSLog(@"yes"); } else { fromView = self.backView; toView = self.frontView; } [UIView transitionFromView:fromView toView:toView duration:1.0 options:options completion:^(BOOL finished) { // animation completed }];
UIViewAnimationOptions transitionOptions = ([self.frontView superview] != nil) ?
    UIViewAnimationOptionTransitionFlipFromLeft : UIViewAnimationOptionTransitionFlipFromRight;
有这几种方式
UIViewAnimationOptionTransitionNone            = 0 << 20, // default
    UIViewAnimationOptionTransitionFlipFromLeft    = 1 << 20,
    UIViewAnimationOptionTransitionFlipFromRight   = 2 << 20,
    UIViewAnimationOptionTransitionCurlUp          = 3 << 20,
    UIViewAnimationOptionTransitionCurlDown        = 4 << 20,
    UIViewAnimationOptionTransitionCrossDissolve   = 5 << 20,
    UIViewAnimationOptionTransitionFlipFromTop     = 6 << 20,
    UIViewAnimationOptionTransitionFlipFromBottom  = 7 << 20,

单个View动画效果

[UIView animateWithDuration:1 delay:0.5f options:UIViewAnimationOptionAutoreverse animations:^{
        self.frontView.alpha=0.0f;
    } completion:^(BOOL finished) {
        self.frontView.alpha=1.0f;
    }];

 

原文地址:https://www.cnblogs.com/shaonian/p/3193380.html