5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UIImageViewに、長辺をクロップした画像を縮小表示する

Last updated at Posted at 2012-06-20
AppDelegate.m

// 画像
NSBundle* bundle = [NSBundle mainBundle];
NSString* path = [bundle pathForResource:@"test" ofType:@"jpg"];
UIImage *img = [UIImage imageWithContentsOfFile:path];

// UIImageViewにセット
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 10.0, 128.0, 128.0)];
imgView.clipsToBounds = YES;
imgView.contentMode = UIViewContentModeScaleAspectFill;
imgView.image = img;

// 表示
[self.window addSubview:imgView];

図版

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?