UIImageView stretching


When running the code on this chapter (sample below), the image is always stretched. I have searched the documentation and can’t find the issue. The UIScrollView’s content size is right, so why would it stretch the image?

@implementation ImageViewController
@synthesize image;
-(void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear];
	CGSize imageSize = [[self image] size];
	[scrollView setContentSize:imageSize];
	[imageView setFrame:CGRectMake(0.0, 0.0, imageSize.width, imageSize.height)];
	[imageView setImage:[self image]];


I discovered the culprit… Xcode 4.5 sets views by default to “Use Autolayout”. Unchecking this options sets things right.