zoukankan      html  css  js  c++  java
  • UIView animation

    UIView的动画其实很不复杂,但是流程老忘记,几个笔记

    看过官方文档的都知道,官方推荐在iOS4以后使用[UIView animateWithDuration:animations:],而不是原来的[UIView beginAnimations:context:],来完成动画,虽然二者功能几乎完全相同,但使用前者在一些情况下会方便不少,这些内容可以参考官方文档View Programming Guide For iOS的Animation一节.

    二者有一个值得新手注意的区别就是[UIView animateWithDuration:animations:]默认会禁止触摸,手势等的响应,这可以通过设置option选项来解决(直接引用StackOverFlow的一段了):

    UIViewAnimationOptions options = UIViewAnimationCurveLinear | UIViewAnimationOptionAllowUserInteraction;

     

    [UIView animateWithDuration:0.2 delay:0.0 options:options animations:^

     {

         highlightView.alpha = 1.0;

     

     } completion:nil];


    、、

    [UIView animateWithDuration:duration

                              delay:0.0

                            options:UIViewAnimationCurveEaseInOut //设置动画类型

                         animations:^{

                             //开始动画

                             [self updateArrowBtnTitle:YES];

                             rotateView.transform = CGAffineTransformMakeRotation((stickToDegrees/180)*M_PI);

                         }

                         completion:^(BOOL finished){

                             // 动画结束时的处理

                         }];

    [UIView animateWithDuration:] 方法仅支持ios4.0及以上版本。如果要兼容以前的版本的话,还是需要使用 [UIView beginAnimation:] 方法

    [UIView beginAnimations:nil context:nil];

        // fade out

        helpImageBtn.alpha = 0.0f;

        // set animation did stop selector

        [UIView setAnimationDelegate:self];

        [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];

        [UIView commitAnimations];


       - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {

        if (self.retainedHelpImageBtn.superview) //先判断父视图再执行视图移除

            [self.retainedHelpImageBtn removeFromSuperview];

       }

    FROM:http://blog.csdn.net/zhanglei5415/article/details/7006626 

  • 相关阅读:
    【Statistics】均值
    【Datastage】在win10安装Datastge 8.7
    【Linux】行首、行尾添加字符串
    【Linux】替换文本中的字符
    【Pyhton 数据分析】通过gensim进行文本相似度分析
    【Python 数据分析】jieba文本挖掘
    异或运算法则
    关于计算机中的《补码》,公式:-n=~n+1 引伸:~n=-n-1
    Base64编码解码
    位运算之——按位与(&)操作——(快速取模算法)
  • 原文地址:https://www.cnblogs.com/likwo/p/2654849.html
Copyright © 2011-2022 走看看