In many situations, it is necessary to turn the controller and not work. Right now, I have the inverse problem: it rotates, and I want to disconnect.
In this ViewController, I have the following:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
but it automatically rotates because this UIViewController is not being requested, but its parent in the user interface tree. Perhaps this is the problem. The root controller should return Yes for all cases, because there are several other UIViewControllers on the stack that have / must have Portait / Landscape support.
I can’t / don’t want to touch other parts, because ... there are several reasons, for example: the application is huge, with a lot of errors, and I don’t want to do 1 and check it for 1 week, the other is the deadline.
Please do not suggest that this is not so and should be rewritten. I know.
How to deal with this controller to force Portait?
Also read the bold text: it cannot force the entire application to support only Portait for 1 view controller, there are a lot of them on the stack!
user529543
source
share