代码之家  ›  专栏  ›  技术社区  ›  Rits

如何在Notes iPad应用程序中重新创建动画?

  •  3
  • Rits  · 技术社区  · 14 年前

    当您在横向模式下使用Notes iPad应用程序(来自苹果)时,您会看到左边的注释列表。如果你选择一个笔记,你会看到一个很好的小动画,看起来像是有人用红铅笔在笔记上做了标记。

    我已经有了一个看起来像那个红色圆圈的图形,但我该如何使它像那个样具有动画效果呢?提前谢谢。

    编辑1
    以下是图形的链接: red circle

    2 回复  |  直到 14 年前
        1
  •  2
  •   imaginaryboy    14 年前

    UIImageView

    NSArray* imageFrames = [NSArray arrayWithObjects:[UIImage imageNamed:@"frame1.png"],
                                                     [UIImage imageNamed:@"frame2.png"],
                                                     [UIImage imageNamed:@"frame3.png"],
                                                     [UIImage imageNamed:@"frame4.png"],
                                                     nil];
    UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,100,100)];
    [imageView setAnimationImages:imageFrames];
    [imageView setAnimationDuration:10];
    [imageView setAnimationRepeatCount:3];
    

    UIImageView documentation

        2
  •  1
  •   Dave DeLong    14 年前
    - (void)moveRedCircle {
        UIImageView *redcircle = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"redcircle.png"]];
        redcircle.bounds.origin = CGPointMake(x, y);
        [self.view addSubview:redcircle];
        [UIView animateWithDuration:4 animations:^{
            redcircle.bounds.origin = CGPointMake(x, y);
        }];
    }