I have an app that uses a UIViewController to display articles in a UIWebView, some of which have images. I have it set up so that when an image is clicked it calls
- (void)displayImage:(NSInteger)i {
ImageViewController * imageVC = [[ImageViewController alloc] initWithImageId:i];
[self.navigationController pushViewController:imageVC animated:YES];
[imageVC release];
}
This loads another UIViewController. All of my views responds perfectly fine to rotations. The ImageViewController maintains the proportions of the image and my ArticleViewController fills the screen with text. However, whenever I rotate the screen to landscape mode while viewing my ImageViewController and press the back button. The previous UIViewController autoresizes incorrectly, increasing the font size of the text rather than putting more words on a line.
EDIT:
This is an article view controller:
This is the ImageViewController that comes up when you click the image:
Now if we change the orientation here...
And hit the back button, the article content has been inappropriately resized to fit the window.
This can be corrected by turning the iPhone twice. This is what the article should look like in landscape.
The problem has something to do with the UIWebView not autoresizing appropriately when it isn't currently visible. What can I do to fix this?
You need to do this in Interface Builder.
Click on your UIWebView and press Apple-3 to pull up the "Size Inspector".
Under "Autosizing", make sure the two arrows inside the box are selected. This will make sure the view size is always maximized to its container.