CABasicAnimation不希望的延迟向上/向下滑动UIView

时间:2014-09-03 22:50:22

标签: ios ios7 uiview core-animation cabasicanimation

我有一个UIView,我正试图滑离屏幕。我尝试使用[UIView animateWithDuration: delay: options: animations: completion:]方法执行此操作,但结果是非常不连贯的动画。为了解决这个问题,我使用以下方法向下滑动UIView“gameLayer”:

    CABasicAnimation* theAnim = [CABasicAnimation animationWithKeyPath:@"position.y"];
    theAnim.fromValue = @(kScreenHeight-150);
    theAnim.toValue = @(kScreenHeight);
    theAnim.duration = 0.4;
    theAnim.beginTime = 0;

    [gameLayer.layer addAnimation:slideDown forKey:@"AnimateFrame"];

    gameLayer.layer.position = CGPointMake(0, kScreenHeight); 

动画导致UIView稍微向下跳(4个像素左右)然后相对平滑地继续。有关为什么会发生这种情况以及如何解决问题的任何想法?感谢

0 个答案:

没有答案