Click the view controller in the portrait with the view controller in the landscape

I have a UITableViewController that works in both portrait and landscape. From this controller, I click another view controller on the navigation controller. This new viewController is a portrait only.

The problem is that when I am in the landscape and click on the view controller, the new view manager is in the landscape until I rotate it to the portrait. Then he got stuck in the portrait, as it should be.

Can I always display it in a portrait? Even if his parent clicks on him in the landscape?

Update:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
+3
source share
2 answers

In yours viewWillAppear:use the following code:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
0
source

WillAppear: :

//present/dismiss viewcontroller in order to activate rotating.
UIViewController *mVC = [[[UIViewController alloc] init] autorelease];
[self presentModalViewController:mVC animated:NO];
[self dismissModalViewControllerAnimated:NO];

, !

P.S.Tested sdk 3.2.5 ios 5.0.1.

+2

All Articles