Reputation: 1120
I have a problem with my app. I would like lock rotation on specific view. For that, I use rootviewcontroller which contain two custom viewControllers. I have try to override the shouldAutorotateToInterfaceOrientation method on my two viewcontrollers but if I allow all rotation on my rootViewController, all my viewcontrollers can rotate like my rootviewcontroller and I don't understand why.
Actually I use this configuration :
RootviewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//By default, i allow all rotation
return YES
}
FirstCustomviewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//On my first viewController, I allow only orientation in portrait
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
But in all case, it allow all rotation (I think it come from rootviewcontroller) and why I can't override this method ? What can I do for that ?
Thanks
Upvotes: 0
Views: 381
Reputation: 9600
RootViewController and FirstCustomViewController relations is exactly push-view or modal-view? If a relations is push-view, all sub-view rotation is rely on the root-view.
Think of a UINavigationController as a house and UIViewControllers as rooms. All the rooms in the house will rotate in the same way the house. There is no way to turn a room without turning the house and other rooms.
Upvotes: 1