- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//启动画面为横屏!!
[application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
//获得屏幕当前屏幕方向
NSLog(@"[[UIDevice currentDevice] orientation]==%d",[[UIDevice currentDevice] orientation]);}
这个函数只能是在程序完全启动之后,才能调用之后,一般用于viewdidload之后。
本文介绍了一个iOS应用启动时如何设置启动画面为横屏,并初始化主窗口和视图控制器的过程。此外,还展示了如何获取设备当前的屏幕方向。
1549

被折叠的 条评论
为什么被折叠?



