【发布时间】:2012-09-13 10:33:08
【问题描述】:
我在 UIViewController 中使用 Storyboard 创建了一个 UIImageView。
我正在尝试重新缩放图像的宽度以适应屏幕宽度并按比例重新缩放高度:
[fImage setImage:[UIImage imageNamed: @"f2345.jpeg"]];
[fImage sizeToFit];
fImage.contentMode = UIViewContentModeScaleAspectFit;
CGRect frame = filmImage.frame;
frame.size.width = [[UIScreen mainScreen] bounds].size.width;
// Alternative way to do the similar thing - gives the same result in my case
// frame.size.width = [[UIScreen mainScreen] applicationFrame].size.width;
fImage.frame = frame;
然后它会显示一个缩放的图像,但它适合其他一些区域,并且我的图像周围有一个空白。
【问题讨论】: