ios中的一些动画(-)

// 标记着动画块的开始第一个参数表示动画的名字,起到标识的作用,第二个参数表示可以一个对象和一个指针

    [UIViewbeginAnimations:nilcontext:NULL]; 

    [UIViewsetAnimationDuration:1]; // 动画的持续时间

    [UIViewsetAnimationDelay:2];    // 动画延迟的时间

    view1.alpha = 0.0

    // 标记着动画块的结束

    [UIViewcommitAnimations];

 

 // 标记着动画块的开始第一个参数表示动画的名字,起到标识的作用,第二个参数表示可以一个对象和一个指针

    [UIViewbeginAnimations:nilcontext:NULL]; 

    [UIViewsetAnimationDuration:5]; // 动画的持续时间

//    [UIView setAnimationDelay:2];    // 动画延迟的时间

    [UIViewsetAnimationCurve:UIViewAnimationCurveEaseOut];

    view1.center = CGPointMake(0, 0); 

    // 标记着动画块的结束

    [UIViewcommitAnimations];

 

// 标记着动画块的开始第一个参数表示动画的名字,起到标识的作用,第二个参数表示可以一个对象和一个指针

    [UIViewbeginAnimations:nilcontext:NULL]; 

    [UIViewsetAnimationDuration:1]; // 动画的持续时间

    view1.transform = CGAffineTransformMakeScale(0.5, 0.5); 

    // 标记着动画块的结束

    [UIViewcommitAnimations];

 

 // 标记着动画块的开始第一个参数表示动画的名字,起到标识的作用,第二个参数表示可以一个对象和一个指针

    [UIViewbeginAnimations:nilcontext:NULL]; 

    [UIViewsetAnimationDuration:1]; // 动画的持续时间

    view1.transform = CGAffineTransformMakeRotation(3.14/2); // 旋转控件

    // 标记着动画块的结束

    [UIViewcommitAnimations];

 

 // 这是UIView指定的代理方法

  /*

    NSString *string = @"这是一个字符串";

    // 标记着动画块的开始第一个参数表示动画的名字,起到标识的作用,第二个参数表示可以一个对象和一个指针

    [UIView beginAnimations:@"Frame 1" context:string]; 

    [UIView setAnimationDuration:1]; // 动画的持续时间

    [UIView setAnimationDelay:1];

    view1.frame = CGRectMake(0, 300, 250, 250); 

    [UIView setAnimationDelegate:self];

    // 标记着动画块的结束

    [UIView commitAnimations];

   */

 

[UIView beginAnimations:@"Frame 2" context:NULL]; 

    [UIView setAnimationDuration:1]; // 动画的持续时间

    view2.frame = CGRectMake(20, 300, 50, 50); 

    [UIView setAnimationDelegate:self];

    // 标记着动画块的结束

    [UIView commitAnimations];

 

  // 我们自定义一个代理方法

    [UIViewbeginAnimations:@"Frame 3"context:NULL]; 

    [UIViewsetAnimationDuration:1]; // 动画的持续时间

    view1.frame = CGRectMake(0, 300, 250, 250); 

    [UIViewsetAnimationDelegate:self];

    [UIViewsetAnimationWillStartSelector:@selector(animationStart)];

    [UIViewsetAnimationDidStopSelector:@selector(animationStop)];

    // 标记着动画块的结束

    [UIViewcommitAnimations];

 

[UIViewbeginAnimations:@"transition"context:NULL]; 

    [UIViewsetAnimationDuration:1];     // 动画的持续时间

    [UIViewsetAnimationRepeatCount:10]; // 执行动画次数

    [UIViewsetAnimationTransition:UIViewAnimationTransitionCurlUpforView:parentViewcache:YES];  // 动画效果、基于那个视图执行动画、是否存在缓存

    [parentViewexchangeSubviewAtIndex:0withSubviewAtIndex:1]; // 更改子视图的位置

    // 标记着动画块的结束

    [UIViewcommitAnimations]; 

 

 // 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");

    }];

 

 

 

 

 

 

 

 

posted on 2013-02-25 22:16  面包旅行  阅读(227)  评论(0)    收藏  举报

导航