Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIView动画:模拟速度_Ios_Iphone_Cocoa Touch_Core Animation_Uiviewanimation - Fatal编程技术网

Ios UIView动画:模拟速度

Ios UIView动画:模拟速度,ios,iphone,cocoa-touch,core-animation,uiviewanimation,Ios,Iphone,Cocoa Touch,Core Animation,Uiviewanimation,我试图使用ui视图动画将视图简单地移动到屏幕上: [UIView animateWithDuration:.10 delay:0 options: nil animations:^ { self.menusView.frame = endingMenuViewFrame;; } completion:^(BOOL finished) { }]; 我想添加一个动画,这样UIView在下降之前到达顶部时会稍微浮动,也就是说,类似于有人在空中跳跃-

我试图使用
ui视图
动画将视图简单地移动到屏幕上:

  [UIView animateWithDuration:.10 delay:0 options: nil animations:^
   {
       self.menusView.frame = endingMenuViewFrame;;
   }
    completion:^(BOOL finished)
   {

   }];

我想添加一个动画,这样UIView在下降之前到达顶部时会稍微浮动,也就是说,类似于有人在空中跳跃-当他们第一次跳跃时,他们迅速向上跳跃,但当他们到达跳跃顶部时,重力会逐渐减慢他们的速度,最终将他们推回地球。有人知道如何做到这一点吗?

试试这段代码。这将使您的视图反弹三次,每次高度降低一半。您可以添加更多反弹

CGFloat offset = 200.0;

CGRect originalFrame = self.menusView.frame;

[UIView animateWithDuration:1.0 animations:^{
    CGRect frame = self.runnerAlertView.frame;
    frame.origin.y = frame.origin.y - offset;
    self.menusView.frame = frame;
} completion:^(BOOL finished){
    [UIView animateWithDuration:1.0 animations:^{

        self.menusView.frame = originalFrame;
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:1.0 animations:^{
            CGRect frame = self.menusView.frame;
            frame.origin.y = frame.origin.y - 0.5 *offset;
            self.menusView.frame = frame;
        } completion:^(BOOL finished){
            [UIView animateWithDuration:1.0 animations:^{

                self.menusView.frame = originalFrame;
            } completion:^(BOOL finished) {
                [UIView animateWithDuration:1.0 animations:^{
                    CGRect frame = self.runnerAlertView.frame;
                    frame.origin.y = frame.origin.y - 0.25 * offset;
                    self.menusView.frame = frame;
                } completion:^(BOOL finished){
                    [UIView animateWithDuration:1.0 animations:^{

                        self.menusView.frame = originalFrame;
                    }];
            }];
        }];
        }];
    }];
}];

+谢谢你。有点像这样,我和你一样玩弄嵌套UIViewAnimations,但它从来没有完全正确过。我想知道我是否需要使用核心动画来代替。