我对 UIImageView 显示图像的方式感到非常失望。
我有以下代码:
UIImageView *imgview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 100)];
imgview.image = [UIImage imageNamed:@"img.JPG"];
imgview.backgroundColor = [UIColor greenColor];
imgview.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:imgview];
我得到的是以下屏幕截图:
http://img26.imageshack.us/img26/3686/screenshot20130123at629.png
[图像被拉伸到 UIImageView 的全宽,甚至没有全高]
原图:
http://img248.imageshack.us/img248/341/screenshot20130123at638.png