Xcode 5, disabling Storyboards [duplicate]

时间秒杀一切 提交于 2019-11-28 22:26:36

问题


I don't want to use story boards, i'd much rather use NIB's for UI when necessary, and I particularly don't want to use them for the default templates.

Xcode 5 no longer has the check box to say you don't want to use Storyboards,

can anyone help? It's really annoying...


回答1:


STEPS FOR REMOVE STORY BOARD - XCode 5 (EDIT)

1/ Create an empty project

2/ Add new files with xib for your controller , if it is not added in compiled sources in build phases then add there manually.

4) Change appdelegate didFinishLaunchingWithOptions file and add :

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;

[self.window makeKeyAndVisible];

just like :

  - (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;
  }

STEPS FOR REMOVE STORY BOARD

1) Remove Main.storyboard file from your project.

2) Add new files with xib for your controller , if it is not added in compiled sources in build phases then add there manually.

3) Remove Main storyboard file base name from plist.

4) Change appdelegate didFinishLaunchingWithOptions file and add :

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;

[self.window makeKeyAndVisible];

just like :

  - (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;
}

Have a look here




回答2:


Use this script to get all the shiny, happy glorious goodness of the Xcode 4 templates back: https://github.com/jfahrenkrug/Xcode4templates

You will need a copy of the Xcode 4 .app bundle to use this script.



来源:https://stackoverflow.com/questions/19052696/xcode-5-disabling-storyboards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!