xcode 如何从我的应用程序中删除 iPad 支持?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20534315/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove iPad support from my app?
提问by tomjung
I created an app with an iPad storyboard, but we've decided not to support iPad to start with. Do I need to disable this somewhere in my project, or delete it? Can't seem to find any information on editing it after the project has been created.
我创建了一个带有 iPad 故事板的应用程序,但我们决定从一开始就不支持 iPad。我需要在我的项目中的某处禁用它,还是删除它?创建项目后,似乎找不到有关编辑它的任何信息。
回答by JuJoDi
At a minimum you have to disable support for iPad. To do that:
您至少必须禁用对 iPad 的支持。要做到这一点:
Click the target in the project explorer. In the General Tab there is a section called Deployment info. For Devices change the selection from Universal to iPhone.
单击项目资源管理器中的目标。在常规选项卡中有一个名为部署信息的部分。对于设备,将选择从通用更改为 iPhone。
You can then delete the iPad storyboard from the project explorer.
然后您可以从项目资源管理器中删除 iPad 故事板。
回答by sanjaymathad
You have to remove storyboard. Here are the steps
您必须删除故事板。以下是步骤
1) Remove Main.storyboard file from your project.
1) 从您的项目中删除 Main.storyboard 文件。
2) Add new files with xib for your controller , if it is not added in compiled sources in build phases then add there manually.
2)为您的控制器添加带有 xib 的新文件,如果它没有在构建阶段添加到编译源中,则手动添加。
3) Remove Main storyboard file base name from plist.
3) 从 plist 中删除主故事板文件的基本名称。
4) Change appdelegate didFinishLaunchingWithOptions file and add :
4) 更改 appdelegate didFinishLaunchingWithOptions 文件并添加:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
[self.window makeKeyAndVisible]; just like :
[self.window makeKeyAndVisible]; 就像 :
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
// Override point for customization after application launch.
TestViewController *test = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:test]; self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES; }
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
// 在应用程序启动后覆盖自定义点。
TestViewController *test = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:test]; self.window.rootViewController = 导航;
[self.window makeKeyAndVisible];
返回是;}
If you want to add controller which does not have nib file then just do TestViewController *test = [[TestViewController alloc] init];
如果你想添加没有 nib 文件的控制器,那么只需执行 TestViewController *test = [[TestViewController alloc] init];
Hope it helps :)
希望能帮助到你 :)