2012年1月3日 星期二

用animationImages呈現動畫

-(void)showGood{
    chefAnimation.animationImages = [NSArray arrayWithObjects:
                                     [UIImage imageNamed:@"chef_good1.png"], //動畫由哪些圖片組成
                                     [UIImage imageNamed:@"chef_good2.png"],
                                     [UIImage imageNamed:@"chef_good2.png"],
                                     [UIImage imageNamed:@"chef_good2.png"],
                                     [UIImage imageNamed:@"chef_good2.png"],
                                     nil];
    
    [chefAnimation setAnimationRepeatCount:3]; //動畫重覆播放的次數
    chefAnimation.animationDuration = 3; //動畫每一輪的時間(秒)
    [chefAnimation startAnimating]; //開始執行動畫
}

0 意見:

張貼留言