开发者

Opening a view in Landscape mode [duplicate]

This question already has an answer here: how to change landscape mode (1 answer) Closed 8 years ago.

I am developing an application in开发者_Go百科 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!!


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


I think that'l do:

[[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeRight];

Im not sure though...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜