iOS图片按比例显示

只需加这么一段代码,如下:

imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.autoresizesSubviews = YES;
imageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;

你可能感兴趣的:(iOS图片按比例显示)