【发布时间】:2015-08-08 04:49:28
【问题描述】:
我的 UIImageView 在视图中,它将从服务器下载图像,下载完成后,我的 UIImageView 高度将根据图像的高度进行调整,但问题是它在 iOS8 中运行良好,但在 iOS7 中运行不正常。在 iOS7 中,高度缩放到比我尝试设置的要高得多。我正在通过 IB 设置自动布局
这是我的代码的摘录(默认为 250)
if(image.size.height<250) headerView.itemImageView.contentMode = UIViewContentModeCenter;
else{
adjustedHeight = image.size.height*320.0f/image.size.width;
imageHeight = adjustedHeight;
[headerView.heightContraintLayout setConstant:adjustedHeight];
[headerView.itemImageView layoutIfNeeded];
//after this line of code, I check the size of itemImageView is extended more than the adjestedHeight that I set in the previous line ( this only happened in iOS7 not iOS8
【问题讨论】:
标签: ios objective-c uiimageview autolayout