xcode6.0.1创建空工程/Empty Application
最后更新于:2022-04-01 09:45:16
大家会发现在xcode6中找不到创建空工程的图标了,对于用惯了空工程来说,使用单视图界面会不习惯,甚至不会,接下来将告诉大家如何在xcode6.0.1中创建空工程。
之前版本Xcode创建应用的选项有
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-03-01_56d55db6bd485.jpg)
Xcode6.0.1就没了这个选项
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-03-01_56d55db6d2273.jpg)
用single view Application是不是觉得很不好用呢。
下面是解决方法。
首先创建个Single View Application
删除Main.storyboard, LaunchScreen.xib根据自己需要选择是否删除!
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-03-01_56d55db6e861a.jpg)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-03-01_56d55db73a540.jpg)
如果ViewController不用也可以顺手删掉了
接下来找到info.plist 删掉Main storyboard file base name这个选项
注意:如果你之前有删除掉LaunchScreen.xib,请将 Launch screen interface file base name 这个选项的内容置空!记得不要删除这个key,不然超过3.5inch的设备会出现上下黑边的情况!
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-03-01_56d55db753be1.jpg)
然后回到AppDelegate.m的
~~~
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions的方法内创建就可以了
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
ViewController *viewcontroller = [[ViewController alloc]init];
self.window.rootViewController = viewcontroller;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
// Override point for customization after application launch.
return YES;
}
~~~
如果有报错,记得看下是否有导入对应的视图控制器的头文件!
这样就可以开始使用空工程咯~~~~
**当然啦,你觉得第一种方法每次搭建太麻烦了,可以一劳永逸的办法!!!**
这里有一个包,http://download.csdn.net/detail/it_ds/9387057
下载之后把安装包放到到目录{Xcode.app}下的/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS/Application/ 中
这样每次打开XCode后都能看到如下的空工程啦!![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/2016-03-01_56d55db76eb37.jpg)