I have a UIViewController with a xib and when ever I am allocating it, the view and width of the UIViewController does not adjust with the orientation I am in, it is always set to portrait. Even if I am at landscape. Why is this? Here’s how I am initializing it:
PNRWebViewController *wvController = [[PNRWebViewController alloc] initWithNibName:@"PNRWebViewController" bundle:nil];
[self.view addSubview:self.webViewController_.view];
There are a ton of reasons why this could happen. Check out the official Apple Q&A Guide on the subject:
Why won’t my UIViewController rotate with the device?
The view controller does not implement this delegate method:
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
The view controller’s UIView property is embedded inside UIWindow but alongside an additional view controller.
You have added your view controller’s UIView property to UIWindow as a subview, but prematurely released it soon after.
All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set.
Overriding the
-(id)init:or-(id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundlemethod without calling super.