zoukankan      html  css  js  c++  java
  • UIView 动画效果的四种调用方式

     1 - (void)fadeMe {
     2     [UIView animateWithDuration:1.0 animations:^{
     3         fadeMeView.alpha = 0.0f;    // 作用在fadeMeView视图
     4     }];
     5 }
     6 
     7 - (void)moveMe {
     8     [UIView animateWithDuration:0.5 animations:^{
     9         moveMeView.center = CGPointMake(moveMeView.center.x
                      , moveMeView.center.y - 200);  
    // 作用在moveMeView视图
    10 }];
    11 }
     1     [UIView transitionWithView:noteView duration:0.6   // 在noteView视图上设置过渡效果
     2                        options:UIViewAnimationOptionTransitionCurlUp
     3                     animations:^{
     4                         NSString *currentText = noteView.text;
     5                         noteView.text = nextText;
     6                         self.nextText = currentText;
     7                     }
     8                     completion:^(BOOL finished){
     9                         
    10                     }];
     1 //   前台页面
     2     UIView *frontView = [[UIView alloc] initWithFrame:self.view.bounds];
     3     frontView.backgroundColor = [UIColor colorWithRed:0.345 green:0.349 blue:0.365 alpha:1.000];
     4     UIImageView *caLogoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"caLogo.png"]];
     5     caLogoView.frame = CGRectMake(70, 80
     6                                   , caLogoView.bounds.size.width
     7                                   , caLogoView.bounds.size.height);
     8     [frontView addSubview:caLogoView];
     9     
    10     // 后台页面
    11     UIImage *backImage = [UIImage imageNamed:@"backView.png"];
    12     UIImageView *backView = [[UIImageView alloc] initWithImage:backImage];
    13     backView.userInteractionEnabled = YES;
    14     
    15     [self.view addSubview:backView];
    16     [self.view addSubview:frontView];
    1     [UIView transitionFromView:frontView    // 从原来视图转到新视图的动画效果设置
    2                         toView:backView3                       duration:1.0f
    4                    options:UIViewAnimationOptionTransitionFlipFromLeft
    5                     completion:^{
    6                     
    7                     }];
     1     [UIView beginAnimations:@"View Flip" context:nil];
     2     
     3     [UIView setAnimationDuration:1.25];//动画持续时间
     4     [UIView setAnimationDelegate:self];//设置动画的回调函数,设置后可以使用回调方法
     5     [UIView  setAnimationCurve: UIViewAnimationCurveEaseInOut];//设置动画曲线,控制动画速度
     6     
     7     [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp
     8                            forView:noteView
     9                              cache:YES];//设置动画方式,并指出动画发生的位置
    10     
    11     [UIView commitAnimations];//提交UIView动画
  • 相关阅读:
    Gates entitled as knight
    the next generation Office
    Beautiful songs
    一则比较搞笑的新闻:【人才】微软招募英才 机会不容错过
    About cmt lint tools
    Alpha's blog open !
    抱歉!
    新闻:IBM的新工具CHIPHOPPER! 一套能够极大扩展Linux应用范围的新工具、新资源和新软件
    读书笔记:Thinking in Java (一)
    The best coders are:/什么是最牛的程序员
  • 原文地址:https://www.cnblogs.com/sell/p/2909522.html
Copyright © 2011-2022 走看看