xcode5 不使用 storyboard

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

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

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

///////////////////////////////////////////////////////////////////////////END///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////spa

If you have Already Created Application with storyboard and ARC thencode

STEPS FOR REMOVE STORY BOARDci

1) Remove Main.storyboard file from your project.it

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

3) Remove Main storyboard file base name from plist.console

4) Change appdelegate didFinishLaunchingWithOptions file and add :class

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.

Remove ARC: Go to Build Setting -> Objective-C Automatic Reference Counting -> NO

相關文章
相關標籤/搜索