Xcode 5,禁用故事板

我不想使用故事板,我更倾向于在必要时使用NIB用于UI,我特别不想将它们用于默认模板。

Xcode 5不再有复选框表示你不想使用Storyboard,

有人可以帮忙吗? 这真烦人……

删除故事板的步骤 – XCode 5(编辑)

1 /创建一个空项目

2 /为控制器添加带xib的新文件,如果在构建阶段未在编译源中添加,则手动添加。

4)更改appdelegate didFinishLaunchingWithOptions文件并添加:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ; [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; } 

删除故事板的步骤

1)从项目中删除Main.storyboard文件。

2)为控制器添加带有xib的新文件,如果在构建阶段没有在编译源中添加,则手动添加。

3)从plist中删除主故事板文件基本名称。

4)更改appdelegate didFinishLaunchingWithOptions文件并添加:

 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ; [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; } 

看看这里

使用此脚本可以获得Xcode 4模板的所有shiny,快乐的光彩: https : //github.com/jfahrenkrug/Xcode4templates

您将需要Xcode 4 .app包的副本才能使用此脚本。