0
votes

I've got a system of parent/child view controllers that looks like this

-- (Parent) RootViewController
      -- (Child) ChildController
              -- (Child) GrandChildController1
              -- (Child) GrandChildController2

Basically, I've got a root view controller with a childViewController. That childViewController acts as a parentViewController for a couple other controllers. Now, I'd like to allow one of those GrandChildViewControllers to rotate. But this is the ONLY controller in the hierarchy who is allowed to rotate.

I'm adding child view controllers to the hierarchy like this:

[self addChildViewController:_childViewController];
[self.view addSubview:_childViewController.view];

Now, when the device rotates, my first childViewController is receiving rotation events, but none of the children of that controller (the grand child view controllers) are receiving rotation events. Anyone know why?

Thanks

1
Are you calling the super methods from your rotation callback overrides? - Sanjit Saluja
You should also be calling [_childViewController didMoveToParentViewController], but I don't know if that will fix your problem. - rdelmar
@rdelmar thanks for the heads up. I've added this and unfortunately it didn't fix the issue. - Sean Danzeiser
@SanjitSaluja no i am not, which methods do u mean? - Sean Danzeiser

1 Answers

1
votes

Things to look out for:

  • In iOS 6 you also need to override supportedInterfaceOrientations - overriding shouldAutorotate is not enough.
  • In iOS 5 if a parent VC returns NO for shouldAutorotateToInterfaceOrientation: it will cancel the rotation for child VCs. I'm not sure if the iOS 6 autorotate mechanism behaves similarly.

From your comments I would guess that you are lacking supportedInterfaceOrientations. If my guess is wrong then it might help if you showed us your implementation of the autorotate methods in all of your controllers.