3

I am developing an application in portrait mode.In my one view controller when I click on table view another view opened in portrait mode.I want it to be opened in landscape mode. Please suggest me how to do this. Thanks in advance!!

Gypsa
  • 11,230
  • 6
  • 44
  • 82

3 Answers3

1

As far as I know, the only way to achieve this is to to show the view controller as a modal with

[self presentModalViewController:landscapeViewController animated:YES];

and specify the landscape mode in

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationLandscapeLeft == interfaceOrientation;
}

This is because if a modal view can appear in only one orientation, the app automatically rotates to that orientation.

See the accepted answer for this question for more details: Transitioning to landscape rotation within a uinavigationcontroller

Community
  • 1
  • 1
SzilardD
  • 1,611
  • 2
  • 22
  • 40
0

I think that'l do:

[[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeRight];

Im not sure though...

JJgendarme
  • 1,411
  • 2
  • 16
  • 30
0

I'm pretty sure you cannot use setOrientation anymore, since it is deprecated and apps have been declined for using it.

This may be an option for you:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/33548-alternative-setorientation.html

It rotates the view using a transformation.

halfer
  • 19,824
  • 17
  • 99
  • 186
SJS
  • 2,647
  • 1
  • 17
  • 34