11

我不想使用故事板,我宁愿在必要时将 NIB 用于 UI,而且我特别不想将它们用于默认模板。

Xcode 5 不再有复选框说你不想使用 Storyboards,

谁能帮忙?真的很烦...

4

2 回答 2

31

删除故事板的步骤 - 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;
}

看看这里

于 2013-09-27T14:00:57.923 回答
2

使用此脚本来恢复 Xcode 4 模板的所有闪亮、快乐、光荣的优点:https ://github.com/jfahrenkrug/Xcode4templates

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

于 2013-11-05T15:46:28.803 回答