美文网首页
ios 动画

ios 动画

作者: 大写的空气 | 来源:发表于2018-06-20 14:15 被阅读0次

    关于UIViewblock动画注意点总结:1动画期间,当按下Home键时,动画将会瞬间完成;2.动画虽然是瞬间完成了,但是completion的返回的finishedbool值是false

    - (void)animationMoveViewToCenter:(UIView *)view {  

        [UIView animateWithDuration:1.0f delay:0.5 options:UIViewAnimationOptionCurveEaseInOut animations:^{  

    CGRectbounds = [UIScreen mainScreen].bounds;  

    view.center = CGPointMake(bounds.size.width / 2, bounds.size.height / 2 );  

        }completion:^ (BOOL finished){  

            if (finished) {  

                [self animationMoveViewRightOut:view completion:^(BOOL finished) {  

                    if (finished) {  

                        NSLog(@"animationMoveViewRightOut!!!");  

                    }  

                }];  

            }  

        }];   

    }  

    解决这个问题,如果你不需要在从后台进入前台继续执行动画,你可以将所有的finish判断语句去掉,这个让动画瞬间完成,防止导致一些意外情况;另外你也可以在进入后台的时候用[aView.layerremoveAllAnimations];语句来将该视图的所有动画remove掉,动画也会瞬间完成。在此多解释几句:[aView.layer removeAllAnimations];仅可以removeCABasicAnimationCoreAnimation动画,也可以remove掉所有的UIView animation


    属性动画可以做动画的属性

    opacity 透明度

    backgroundColor 背景颜色

    cornerRadius 圆角

    borderWidth 边框宽度

    contents 内容

    shadowColor 阴影颜色

    shadowOffset 阴影偏移量

    shadowOpacity 阴影透明度

    shadowRadius 阴影圆角

    ...

    rotation 旋转

    transform.rotation.x

    transform.rotation.y

    transform.rotation.z

    ...

    scale 缩放

    transform.scale.x

    transform.scale.y

    transform.scale.z

    ...

    translation 平移

    transform.translation.x

    transform.translation.y

    transform.translation.z

    ...

    position 位置

    position.x

    position.y

    ...

    bounds 

    bounds.size

    bounds.size.width

    bounds.size.height

    bounds.origin

    bounds.origin.x

    bounds.origin.y

    相关文章

      网友评论

          本文标题:ios 动画

          本文链接:https://www.haomeiwen.com/subject/uiityftx.html