我想创建一个iPhone应用程序。我的目标是,它将仅包含加载时间的景观视图。如何从加载时间禁用纵向视图?
答案 0 :(得分:1)
在您的应用程序plist文件中添加“初始界面方向”行并在那里指定所需的初始方向。
答案 1 :(得分:0)
需要苹果登录
Start my application in landscape mode?
在你的plist文件中
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeRight</string>
其他信息
http://developer.apple.com/library/ios/#qa/qa2010/qa1588.html
答案 2 :(得分:0)
最后我得到以下答案。
#import < UIKit / UIKit.h >
@interface LandscapeViewController : UIViewController {
UIStatusBarStyle oldStatusBarStyle;
}
@end
----------------------------
LandscapeViewController.m
--------------------------
#import "LandscapeViewController.h"
@implementation LandscapeViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
oldStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:oldStatusBarStyle animated:NO];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation==UIInterfaceOrientationLandscapeRight);
NSLog(@"DDDDDDDDD");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)dealloc
{
[super dealloc];
}
@end
并参考以下链接执行以下步骤: