http://v.youku.com/v_show/id_XMjk1OTk3MzIw.html?f=6608541
//启动画面为横屏!!
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//启动画面为横屏!!
[applicationsetStatusBarOrientation:UIInterfaceOrientationLandscapeRightanimated:NO];
self.window = [[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewControlleralloc]initWithNibName:@"ViewController"bundle:nil]autorelease];
self.window.rootViewController =self.viewController;
[self.windowmakeKeyAndVisible];
returnYES;
}
//获得屏幕当前屏幕方向
NSLog(@"[[UIDevice currentDevice] orientation]==%d",[[UIDevicecurrentDevice]orientation]);}
这个函数只能是在程序完全启动之后,才能调用之后,一般用于viewdidload之后。
本文介绍了一个在iOS设备上应用启动时设置横屏界面并获取当前屏幕方向的Swift实现方法,通过调用特定函数实现启动画面横屏显示,并在程序完全启动后获取屏幕方向。
2万+

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



