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

Shay
  • 2,595
  • 3
  • 25
  • 35

2 Answers2

2

In your modal view controller implementation, override -shouldAutorotateToInterfaceOrientation:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
  • This is the opposite of what i need. – Shay Dec 15 '09 at 10:40
  • Can you rephrase your question? I'm not sure which option you're asking. – Alex Reynolds Dec 15 '09 at 18:21
  • 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. – Shay Dec 15 '09 at 18:39
  • Have you tried `UIInterfaceOrientationLandscape` in the overridden method above? – Alex Reynolds Dec 16 '09 at 00:22
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];
Matteo Alessani
  • 10,264
  • 4
  • 40
  • 57
Alex Nguyen
  • 2,820
  • 1
  • 19
  • 14