简体   繁体   English

如何从我的应用程序中删除 iPad 支持?

[英]How to remove iPad support from my app?

I created an app with an iPad storyboard, but we've decided not to support iPad to start with.我用 iPad storyboard 创建了一个应用程序,但我们决定不支持 iPad 开始。 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.创建项目后,似乎找不到任何有关对其进行编辑的信息。

At a minimum you have to disable support for iPad. 至少您必须禁用对iPad的支持。 To do that: 要做到这一点:

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. 对于设备,将选择从Universal更改为iPhone。

例

You can then delete the iPad storyboard from the project explorer. 然后,您可以从项目资源管理器中删除iPad故事板。

例题

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]; [self.window makeKeyAndVisible]; just like : 就像 :

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ; (BOOL)应用程序:(UIApplication *)应用程序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]; TestViewController * test = [[TestViewController alloc] initWithNibName:@“TestViewController”bundle:nil]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:test]; UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:test]; self.window.rootViewController = nav; self.window.rootViewController = nav;

    [self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];

    return YES; 返回YES; } }

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 :) 希望能帮助到你 :)

File Inspector -> Selected Target -> General -> UnCheck文件检查器 -> 选定目标 -> 常规 -> 取消选中

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM