Xcode without Storyboard and ARC

PJR picture PJR · Jun 21, 2013 · Viewed 50.7k times · Source

i have downloaded new xcode-5 and just started using it.

We can create application directly including storyboard and ARC , it is not asking for option like earlier versions.

So, my question is how can we use xcode5 without ARC and storyboard. we have to manually remove storyboard file ? or is there any other option.

Answer

PJR picture PJR · Jul 29, 2013

Create a project with an Empty application and Add any viewcontroller (i added TestViewController here)

   - (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 ARC

1) In build setting set Automatic Reference Counting to NO.

///////////////////////////////////////////////////////////////////////////END///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

If you have Already Created Application with storyboard and ARC then

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


Now,in above example you have to manage memory management manually like ,

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

 [test release]; 

STEPS FOR REMOVE ARC

1) In build setting set Automatic Reference Counting to NO.