我已经下载了新的xcode-5,并开始使用它。
我们可以直接创建包括故事板和ARC的应用程序,它不像早期版本那样要求选项。
所以,我的问题是,我们如何使用没有圆弧和故事板的xcode5。我们必须手动删除故事板文件吗?还有没有别的选择。
发布于 2013-07-29 10:57:52
创建一个包含空应用程序的项目,并添加任何视图控制器(我在此处添加了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;
}
删除弧形的步骤
1) In build setting set Automatic Reference Counting to NO。
///////////////////////////////////////////////////////////////////////////END///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
如果您已经使用storyboard和ARC创建了应用程序,则
删除情节提要的步骤
1)从项目中删除Main.storyboard文件。
2)使用xib为你的控制器添加新文件,如果在构建阶段没有添加到编译过的源代码中,则手动添加。
3) Remove Main storyboard file base name from 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;
}
现在,在上面的示例中,您必须手动管理内存管理,
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[test release];
删除弧形的步骤
1) In build setting set Automatic Reference Counting to NO。
发布于 2013-09-20 06:30:02
您可以使用空的应用程序模板创建新项目,而不是删除情节提要文件。这样您就可以避免创建情节提要文件。
使用以下步骤可忽略情节提要:
LoginViewController
) AppDelegate.m
文件中的didFinishLaunchingWithOptions
。更改为:
#import "LoginViewController.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
LoginViewController *loginVC = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:loginVC];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
}
Remove ARC:转到Build Setting -> Objective-C Automatic Reference Counting -> NO
发布于 2013-12-11 08:31:58
创建新项目
//移除Info中的主序列图像板文件基名
在appdelegate中添加此代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
LoginViewController *loginVC = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:loginVC];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
}
然后自动移除你的故事板。
请试试这个。已成功执行。谢谢
https://stackoverflow.com/questions/17234172
复制相似问题