iPhone app in landscape mode, 2008 systems

2019-01-02 22:39发布

Note: this question is from 2008 and now is of only historic interest.


What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device?

Both programmatically and using the Interface Builder.

8条回答
beautiful°
2楼-- · 2019-01-02 23:21

See this answer: Landscape Mode ONLY for iPhone or iPad

  1. add orientation to plist
  2. shouldAutorotateToInterfaceOrientation = YES in all files

Although if you're using mixed modes, you might be better off with

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
查看更多
我只想做你的唯一
3楼-- · 2019-01-02 23:25

sasb's and michaelpryor's answer appears to be correct, but if it's not working for you, try this alternative:

- (void)applicationDidFinishLaunchingUIApplication *)application {
    application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
}

Or this one:

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

Or this one:

[application setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:NO];

You may also have to call window makeKeyAndVisible; first.

A few links: Developing in landscape mode, iPhone SDK: How to force Landscape mode only?

@Robert: please refer to The iPhone SDK, NDA, and Stack Overflow.

查看更多
登录 后发表回答