I have a UIViewController that I want to add on top of the entire app as an independent layer. So I tried adding it to the UIWindow using [self.window addSubview:viewController.view] in the app delegate.
However, when the user rotates the device, I do not get the willRotateToInterfaceOrientation event in my view controller. So I tried doing what was suggested here: I added my view controller as a subview of the root view controller of the window in the app delegate, but my willRotateToInterfaceOrientation is still not being called.
What should I do?
Your rootViewController is acting as a container view controller.
What you are doing is implementing an own view hierarchy, so you are responsible for passing the UILifecycle-Events down along that hierarchy. iOS >= 5.0 supports you creating such container viewControllers, offering the
methods (and more). For iOS < 5.0 you will unfortunately have to do this manually.
In your rootViewController you should hold a reference to your independentLayerController and forward the willRotateToInterfaceOrientation.
Your rootViewController will receive the messages and you can call willRotateToInterfaceOrientation on the independentLayerController.