私はいくつか持っておりUIImage
、それを に表示しUIImageView
ます。
UIViewContentModeScaleAspectFit
コンテンツ モードを使用する必要があります。
簡単なコードは次のとおりです。
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
imageView.image = self.image;
imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:imageView];
[imageView release];
画面に表示されている画像のサイズを知る方法は? 解決策、プロパティはありますか、それとも手動で計算しますか?
編集:
私はその物件について知っていますimage.size
。
self.image.size
->>> 元の画像サイズ
imageView.image.size
->>> imageView のサイズですが、表示された画像ではありません。
imageView's size
表示されているサイズは、商品によって異なりますのでお尋ねしますcontentmode
。