| // 生成例 UIImageView *imageView = [[UIImageView alloc] init]; // UIImageを指定した生成例 UIImage *image = [UIImage imageNamed: @"hoge.png" ]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; |
image
例)imageView.image = [[[UIImage]] imageNamed:@"hoge.png"];
animationImages
例)imageView.animationImages = [NSArray arrayWithObjects:@"hoge1.png", @"hoge2.png", @"hoge.png", nil];
animationRepeatCount
例)imageView.animationRepeatCount = 3;
animationDuration
例)imageView.animationDuration = 0.5;
highlighted
例)imageView.highlighted = YES;
userInteractionEnabled
例)imageView.userInteractionEnabled = YES;
contentMode
例)imageView.contentMode = UIViewContentModeScaleAspectFit;
| 表示方法 | |
| UIViewContentModeScaleToFill | 設定が無い場合、これがデフォルトとなる。UIImageViewのサイズにあわせひろがる |
| UIViewContentModeScaleAspectFit | 画像のaspect比を維持し、UIImageViewのサイズに収まるように設置 |
| UIViewContentModeScaleAspectFill | 画像のaspect比を維持し、UIImageViewのサイズにあわせひろがる |
| UIViewContentModeRedraw | UIViewContentModeScaleToFillと同様 |
| UIViewContentModeCenter | 画像サイズをそのままに、真ん中に表示 |
| UIViewContentModeTop | 画像サイズをそのままに、上に表示 |
| UIViewContentModeBottom | 画像サイズをそのままに、下に表示 |
| UIViewContentModeLeft | 画像サイズをそのままに、左に表示 |
| UIViewContentModeRight | 画像サイズをそのままに、右に表示 |
| UIViewContentModeTopLeft | 画像サイズをそのままに、左上に表示 |
| UIViewContentModeTopRight | 画像サイズをそのままに、右上に表示 |
| UIViewContentModeBottomLeft | 画像サイズをそのままに、左下に表示 |
| UIViewContentModeBottomRight | 画像サイズをそのままに、右下に表示 |
initWithImage:
- (id)initWithImage:(UIImage *)image
例)UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hoge.png"]];
initWithImage:highlightedImage:
- (id)initWithImage:(UIImage *)imagehighlightedImage:(UIImage *)highlightedImage
例)UIImageView *imageView = [[UIImageView alloc] initWithImage:image1 imagehighlightedImage:image2];
startAnimating
- (void)startAnimating
例)[imageView startAnimating];
stopAnimating
- (void)stopAnimating
例)[imageView stopAnimating];
isAnimating
- (BOOL)isAnimating
例)BOOL anime = [imageView isAnimating];