presentModalViewController in landscape after portrait viewController
Asked Answered
J

2

3

I have a main viewController that is in portrait mode all the time.

I want then to presentModalViewController, but it will come from the left (not from bottom of the screen) in landscape.

Is it possible?

tnx

Jeaniejeanine answered 15/12, 2009 at 9:43 Comment(1)
Can you add the code for your modal view controller?Beutler
B
2

In your modal view controller implementation, override -shouldAutorotateToInterfaceOrientation:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Beutler answered 15/12, 2009 at 9:51 Comment(4)
This is the opposite of what i need.Jeaniejeanine
Can you rephrase your question? I'm not sure which option you're asking.Beutler
My main controller is in portrait. Then i turn the device into landscape, but the main controller remains in portrait. Then i want to show another view controller in landscape, and it will show from the bottom. In this situation if you hold the device in vertical(portrait), the new view will come from the left.Jeaniejeanine
Have you tried UIInterfaceOrientationLandscape in the overridden method above?Beutler
S
1

I came across this problem too. So i just used the modaltransitionstyle so it didn't look to iffy.

Hope this helps.

viewController.modalTransitionStyle = *modaltransitionstyle*;

[self presentModalViewController:viewController animated:YES];
Scorch answered 26/5, 2010 at 22:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.