The app delegate’s UIWindow is finicky
I learned the hard way that there is a right way to do things in your didFinishLaunchingWithOptions with regards to self.window, and then there is the way that Apple used to have apps work that does not work any longer.
In case you haven’t heard, screen rotation in iOS 6 is much different from the previous versions of iOS. As a result, I was banging my head against the wall trying to figure out the magic incantation to get my rotation working again, and as it turned out, it had to do with this line of code in my app delegate:
[self.window addSubview:navigationController.view]; |
I was building my UINavigationController in the code and assigning it to the window as shown above. On the advice of an enterprising Stack Overflow user, I changed the line of code to this:
[self.window setRootViewController:navigationController]; |
And now the rotation events are starting to once again fire in my app. Yay.
For some additional information on how iOS6 handles rotation differently, please visit this blog post, which is where I found part of the information that I needed to get rotation working again in my app:
iOS 6 SupportedOrientations with UINavigationController – Shabbir’s Code Snippets
BTW, Happy Anniversary to Devil’s Tower, which was declared to be the first National Monument in the U.S. on this date in 1906. I now have a burning desire to watch Close Encounters for about the 100th time.