默认横屏
在info.plist中增加一项:
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeRight</string>
再加一项 initial interface orientation Landscape(right)
View- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
在interface builder中,点选窗口右上角的旋转图标,把窗口视图转成水平的。
另:
在applicationDidFinishLaunching: 方 法 的 一 开 始 执 行UIApplication的setStatusBarOrientation:animated:方法。