【发布时间】:2014-10-16 07:36:45
【问题描述】:
这是我的 didFinishLaunchingWithOptions:
目前我的应用程序仅适用于 iPhone,但我想要这两者(通用)。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
playerScreenViewController *playerScreen=[[playerScreenViewController alloc] initWithNibName:@"playerScreenViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:playerScreen];
self.window.rootViewController = navigationController;
[[UIApplication sharedApplication] setStatusBarHidden:YES];
self.window.backgroundColor = [UIColor grayColor];
[self.window makeKeyAndVisible];
return YES;
}
而且我不知道如何在 appdelegate 中使用这个条件:
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
// iPad
} else {
// iPhone
}
【问题讨论】:
标签: ios objective-c xib ios-universal-app