我需要为 iPhone 和 iPad 设置一个单独的主界面,但是 Xcode 只允许我为项目设置一个通用的界面 [英] I need to set a separate Main Interface for iPhone and iPad, but Xcode only lets me set one interface for the project when it is universal
问题描述
我无法为 iPad 设置特定的主界面,即使我的应用程序是通用的.Xcode 曾经在 iPhone 和 iPad 上有单独的部署信息选项卡,但现在它们是相同的.然而,我的游戏在 iPhone 和 iPad 上完全不同,我需要为每个界面设置单独的故事板.
I am unable to set a specific Main interface for iPad, even though my app is universal. Xcode used to have separate tabs for the Deployment Info on iPhone and iPad but now they are they same. However my game is radically different on iPhone and iPad and I need to set separate storyboards for each interface.
如果您知道解决方案,请帮忙.
Someone please help if you know the solution.
推荐答案
您可以将 Deployment Info
-> Main Interface
中的值设置为空字符串并实现AppDelegate
中的自定义逻辑:
you could set the value in the Deployment Info
-> Main Interface
to an empty string and implement a custom logic in your AppDelegate
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UIStoryboard *initialStoryboard;
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
initialStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
} else {
initialStoryboard = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = [initialStoryboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
return YES;
}
这篇关于我需要为 iPhone 和 iPad 设置一个单独的主界面,但是 Xcode 只允许我为项目设置一个通用的界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!