Leftover Nav Bar in Landscape View
- by Rob Bonner
Hello,
I am working to force a view into landscape mode, and have picked up all kinds of cool tips to make this happen, but am stuck on one item that is left on the screen.
I have my XIB file laid out in landscape, and in my code I create the view controller normally:
RedeemViewController *aViewController = [[RedeemViewController alloc] initWithNibName:@"RedeemViewController" bundle:nil];
aViewController.hidesBottomBarWhenPushed = YES;
aViewController.wantsFullScreenLayout = YES;
[[self navigationController] pushViewController:aViewController animated:YES];
Inside the controller viewDidLoad I complete the following:
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
[[self navigationController] setNavigationBarHidden:YES animated:YES];
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:.75];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
if (self.interfaceOrientation == UIInterfaceOrientationPortrait) {
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
self.view.bounds = CGRectMake(0.0, 0.0, 480, 320);
}
[UIView commitAnimations];
What I end up with is a perfectly rotated view, with a grey vertical bar on the left side (see pic).
So to the question, how do I get rid of the bar?
Edit: I am pretty sure this is the navigation bar that is not being hidden.
This is a duplicate of another post, with some modified code, the other question was being answered with the bug.