Xcode没有Storyboard和ARC [英] Xcode without Storyboard and ARC
问题描述
我已经下载了新的xcode-5并且刚开始使用它。
i have downloaded new xcode-5 and just started using it.
我们可以直接创建应用程序,包括storyboard和ARC,它不要求像早期版本那样的选项。
We can create application directly including storyboard and ARC , it is not asking for option like earlier versions.
所以,我的问题是如何在没有ARC和故事板的情况下使用xcode5。我们必须手动删除storyboard文件?或者是否还有其他选项。
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.
推荐答案
使用Empty应用程序创建项目并添加任何viewcontroller(我添加了TestViewController)这里)
- (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;
}
删除ARC的步骤
1)在构建设置中将自动引用计数设置为否。
1) In build setting set Automatic Reference Counting to NO.
/////////////////////////////////////// ////////////////////////////////////结束///////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// //////////////////////////////////
如果您已经使用故事板和 ARC 创建了应用程序,那么
If you have Already Created Application with storyboard and ARC then
删除故事的步骤BOARD
1)从项目中删除 Main.storyboard 文件。
2)为控制器添加带xib的新文件,如果在构建阶段未在编译源中添加手动添加。
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)从 plist 中删除主故事板文件基本名称 。
4)更改appdelegate didFinishLaunchingWithOptions 文件并添加:
4) Change appdelegate didFinishLaunchingWithOptions file and add :
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;
}
现在,在上面的示例中,您必须手动管理内存管理,例如,
Now,in above example you have to manage memory management manually like ,
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[test release];
删除ARC的步骤
1)在构建设置中将自动引用计数设置为否。
1) In build setting set Automatic Reference Counting to NO.
这篇关于Xcode没有Storyboard和ARC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!