UIImage 画像サイズの変更 サンプル
// リサイズする大きさを設定します。
CGRect rect = CGRectMake(0, 0, 30, 30);
// イメージをローカルから読み込む
UIImage *image = [UIImage imageNamed:@”test.png”];
// グラフィックスコンテキストを作成
UIGraphicsBeginImageContext(rect.size);
// イメージを描画
[image drawInRect:rect];
// リサイズされた画像を取得
UIImage *createImage = UIGraphicsGetImageFromCurrentImageContext();
// コンテクストを終了
UIGraphicsEndImageContext();
// リサイズされた画像からイメージビューを作成
UIImageView *uiImageView = [[UIImageView alloc] initWithImage:createImage];
// ビューにセット
[self.view addSubview:uiImageView];
// リサイズする大きさを設定します。
CGRect rect = CGRectMake(0, 0, 30, 30);
// イメージをローカルから読み込む
UIImage *image = [UIImage imageNamed:@"test.png"];
// グラフィックスコンテキストを作成
UIGraphicsBeginImageContext(rect.size);
// イメージを描画
[image drawInRect:rect];
// リサイズされた画像を取得
UIImage *createImage = UIGraphicsGetImageFromCurrentImageContext();
// コンテクストを終了
UIGraphicsEndImageContext();
// リサイズされた画像からイメージビューを作成
UIImageView *uiImageView = [[UIImageView alloc] initWithImage:createImage];
// ビューにセット
[self.view addSubview:uiImageView];
