文/罚难(简书作者)
原文链接:http://www.jianshu.com/p/ec7d3f210983
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

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

imageView.contentMode = UIViewContentModeScaleAspectFit;

imageView.autoresizesSubviews = YES;

imageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;