iOS中的Block动画

// block动画1

   /*

    [UIView animateWithDuration:1 animations:^(void) {

   

        [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

        [UIView setAnimationDelegate:self];

        view1.center = CGPointMake(0, 0);

    }];

 

    // block动画2

/*

    [UIView animateWithDuration:1 animations:^(void){

       

        [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

        view1.center = CGPointMake(0, 0);

       

    } completion:^(BOOL finished) {

       

        NSLog(@"finished");

    }];

*/

 

  // block动画3

   /*

    [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionRepeat animations:^(void) {

       

        view1.center = CGPointMake(0, 0);

       

    } completion:^(BOOL finished) {

        NSLog(@"finished");

    }];

     */

   

    // block动画4

   

    [UIViewtransitionFromView:view2toView:view1duration:1options:UIViewAnimationOptionTransitionFlipFromTopcompletion:^(BOOL finished) {

        NSLog(@"finished");

    }];

 

  • animateWithDuration:delay:options:animations:completion:
  • animateWithDuration:animations:completion:
  • animateWithDuration:animations:
  • transitionWithView:duration:options:animations:completion:
  • transitionFromView:toView:duration:options:completion:
原文地址:https://www.cnblogs.com/changjiang/p/3064038.html