如何设置image设置全宽和设置UIViewContentModeScaleAspectFit



我想为UITableviewcell设置一个图像,但imageview contentmode是UIViewContentModeScaleAspectFit,并且设置全宽取决于UI的宽度高度是更改的,如何做到这一点。

UIIMageView内容模式更改为UIViewContentModeScaleToFillUIViewContentModeScaleAspectFill

已编辑

使用以下UITableView's方法

NSMutableArray中添加UIImageView高度(高度阵列)

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return  [heightsArray objectAtIndex:indexpath.row];
}

最新更新