Also titled: One hack to get around UINavigation Controller not supporting orientation changes correctly.

I think this is a well documented bug, discussed here, and here, and here.  Basically, if you are using a UINavigation Controller in your app, the controller completely ignores all of your orientation preferences.  This isn’t an issue if you only use portrait, or if you only use landscape, or if you support both in all your views, but if one of those is false; you’re in trouble.  In MTG Arcanum, Multiplayer (for now) is strictly landscape.  It gives us more room left to right, which I think is important.  I’m working on enhancing Multiplayer, but for now, it’s Landscape.

So, in version 1.2.0, where I include a UINavigation Controller, my app went all wonky.  Multiplayer loaded Portrait, and that did not look good at all.  So, what did I do?  First thing off, in the Multiplayer

- (void)viewDidLoad

I put the line:

[self.navigationController setNavigationBarHidden:YES];

That got rid of the Navigation bar, which was taking up too much room.  But then, instead of using “Push” with the UINavigation Controller, I fell back to some old code to get the new view onto the screen.  One that, you know, respected my orientation preferences.

MultiPlayerViewController *controller = [[MultiPlayerViewController alloc] initWithNibName:@”MultiPlayerView” bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];

Basically, this makes the controller, assigns the delegate back to the view that calls it (which you then use to get rid of the Multiplayer view, as shown in the Utility app), makes the transition, and then shows it.  This causes the Multiplayer view to be loaded in a different way, one that actually correctly orients it.  So now the rest of the app lives with the UINavigation Controller, while Multiplayer is free!  It’s wonderful!