Skip to content

IOS:UIImageView

Frame Animation

이미지를 프레임으로 보여주고 싶을 경우에는 animationImages속성을 사용하면 된다.

UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(40, 30, 200, 200)];
imgView.animationImages = [NSArray arrayWithObjects:
                           [UIImage imageNamed:@"img_satelite01.png"],
                           [UIImage imageNamed:@"img_satelite02.png"],
                           [UIImage imageNamed:@"img_satelite03.png"],
                           [UIImage imageNamed:@"img_satelite04.png"],
                           nil];
[imgView setImage:[UIImage imageNamed:@"img_satelite01.png"]];
imgView.animationRepeatCount = INFINITY; // Same 0 value.
imgView.animationDuration = 1;
[self.view addSubview:imgView];
[imgView release];

[imgView startAnimating];
// ...
[imgView stopAnimating];

Sample code

UIImageView에 이미지를 추가하는 방법.

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, width,height)];
UIImage *image = [UIImage imageNamed:@"image.png"];
imageView.image = image;
[self.view addSubview:imageView];

See also

Favorite site