Ale*_*one 2 animation cocoa-touch objective-c uiview ios
我有一个应用程序存储历史记录中的用户事件.事件将添加到一个控制器上,并显示在不同选项卡中的控制器中.
我想添加一个视觉确认信息,当用户点击"保存按钮"时,已记录事件.我正在考虑动画一个界面元素,以移动一个标签栏控制器,负责向用户显示记录.

为了做到这一点,我正在考虑动画我的一个界面元素的中心点.我知道如何设置中心点的动画,但它是直线的.如何以更"弯曲"的方式为中心点设置动画?有没有办法实现这个目标?
CGPoint center = self.ratingReticle.center;
[UIView animateWithDuration:0.6 delay:0 options:UIViewAnimationCurveEaseIn animations:^{
    //move the element offscreen
     self.ratingReticle.center = CGPointMake(260,500);
} completion:^(BOOL finished) {
    //hide the interace element once it is offscreen
    self.ratingReticle.alpha = 0;
    //restore the position of the interface element
    self.ratingReticle.center = center;
    [ UIView animateWithDuration:0.4 animations:^{
        //fade the element back at the original position
        self.ratingReticle.alpha = 1;
    } completion:^(BOOL finished) {
    }];
}];
您可以使用Core Animation使用Bezier曲线移动对象CAKeyFrameAnimation.
-(void)animate
{
  CAKeyframeAnimation *posAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
  posAnim.path = [self bezierPath];
  [image.layer addAnimation:posAnim forKey:@"posAnim"];
}
哪里bezierPath返回CGPathRef适合你的情况.
| 归档时间: | 
 | 
| 查看次数: | 868 次 | 
| 最近记录: |