Pergunta

Supposing I have a view controller I'm showing like this on an iPad:

[self presentViewController:self.someViewController animated:YES completion:nil];

and dismissing like this:

[self.someViewController dismissViewControllerAnimated:YES completion:nil];

When I open the app on upside-down portrait mode it looks ok, then present the VC which also supports the upside-down portrait and then when I dismiss it, the main VC changes orientation to normal portait mode. Why does it happen? Where should I set it to make it adjust automatically?

Foi útil?

Solução

Looks like there was UIInterfaceOrientationPortrait returned by preferredInterfaceOrientationForPresentation and I fixed this as following:

 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
//changed this:
//    return UIInterfaceOrientationPortrait;
//to this:
return [UIApplication sharedApplication].statusBarOrientation;
}    

Does it seem to look like a reasonable solution?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top