I have a simple UIWebView that I’ve added to my UIViewController in the viewDidLoad method:
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
self.webView = [[UIWebView alloc] initWithFrame:rect];
self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.webView];
And it looks great, but when I rotate the phone, the width and height remain the same so now it’s too wide for the update view frame. I also tried using self.view.bounds, but it didn’t make any difference.
So how do you ensure that a view that is fullscreen on load, stays the same size when rotated? (without using IB)
What you are doing is correct & should work in most scenarios. But since I have no idea about your View Stack. I will suggest a sure shot way –