一、始化方法
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)]; imageView.image = [UIImage imageNamed:@"imageName"]; UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"imageName"]]; UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"imageName1"]highlightedImage:[UIImage imageNamed:@"imageName2"]];
二、幀動畫
imageView.animationDuration = imageArray;//imageArray圖片幀數組(NSMutableArray *)設置為imageView的幀動畫素材數組 imageView.animationDuration = 1;//設置動畫播放一輪的時間,單位秒 imageView.animationRepeatCount = 0;//設置動畫播放的次數,0為無限 [imageView startAnimating];//開始播放動畫 [imageView stopAnimating];//停止播放