还有其他什么方法可以做动画吗?

时间:2010-03-01 14:23:33

标签: iphone image animation sdk uiimageview

除了下面的代码,还有其他方法可以做动画吗?我问,因为我会有一些相当强烈的动画,可以达到20-30帧。我也想知道是否可以用每一帧播放声音?

popup.animationImages = [NSArray arrayWithObjects:
                                 [UIImage imageNamed:@"picture1.png"],
                                 [UIImage imageNamed:@"picture2.png"],
                                 [UIImage imageNamed:@"picture3.png"],
                                 [UIImage imageNamed:@"picture4.png"],
                                 [UIImage imageNamed:@"picture5.png"],
                                 [UIImage imageNamed:@"picture6.png"],
                                 [UIImage imageNamed:@"picture7.png"], nil];
        popup.animationDuration = 1.750567;
        popup.animationRepeatCount = 1;
        [popup startAnimating];
        [self.view addSubview:popup];

1 个答案:

答案 0 :(得分:1)

嗯,缺少像

这样的东西
(NSArray *) createAnimationArrayWithFileStem:(NSString *) stem firstFrame:(int) firstFrame lastFrame:(int) lastFrame{
    NSMutableArray *animationArray = [[NSMutableArray alloc] init];
    for (int currentFrame=firstFrame;currentFrame<=lastFrame;currentFrame++){
        [animationArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%d.png",stem,currentFrame]];
    }
    [animationArray addObject:nil];
    [animationArray autorelease];
    return animationArray;
}

或者非常类似的东西,只允许你做

popup.images = [self createAnimationArrayWithFileStem:@"picture" firstFrame:1 lastFrame:7];