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

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