스토리 보드 및 ARC가없는 Xcode
새 xcode-5를 다운로드하여 사용하기 시작했습니다.
스토리 보드와 ARC를 직접 포함하여 응용 프로그램을 만들 수 있으며 이전 버전과 같은 옵션을 요구하지 않습니다.
그래서 제 질문은 ARC와 스토리 보드없이 xcode5를 어떻게 사용할 수 있는지입니다. 스토리 보드 파일을 수동으로 제거해야합니까? 또는 다른 옵션이 있습니까?
빈 응용 프로그램으로 프로젝트를 만들고 모든 뷰 컨트롤러를 추가하십시오 (여기서는 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) 빌드 설정에서 Automatic Reference Counting 을 NO로 설정하십시오 .
///////////////////////////////////////////////////////// /////////////////////////종료//////////////////////// ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// /////////////////////////
스토리 보드 와 ARC 로 이미 작성된 응용 프로그램이있는 경우
스토리 보드 제거 단계
1) 프로젝트에서 Main.storyboard 파일을 제거하십시오 .
2) 컨트롤러 용 xib 파일을 빌드 단계에서 컴파일 된 소스에 추가하지 않은 경우 수동으로 추가하십시오.
3) 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) 빌드 설정에서 Automatic Reference Counting 을 NO로 설정하십시오 .
스토리 보드 파일을 삭제하는 대신 빈 응용 프로그램 템플릿으로 새 프로젝트를 만들 수 있습니다. 스토리 보드 파일 작성을 피할 수 있습니다.
스토리 보드를 생략하려면 다음 단계를 사용하십시오.
- 빈 응용 프로그램 템플릿으로 새 프로젝트를 만듭니다.
- (예 : 새의 ViewController 추가
LoginViewController
) - 아래에 지정된대로
didFinishLaunchingWithOptions
inAppDelegate.m
파일을 변경하십시오 .
로 변경:
#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;
}
ARC 제거 : 빌드 설정으로 이동-> Objective-C 자동 참조 계산-> 아니오
새 프로젝트를 만들다
![Create new Project]
//remove Main storyboard file base name in Info
Add This Code In 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;
}
Then automatic remove your storyboard.
Please Try this... successfully Executed. thanks
ShortCut: I Prefer
Create the project without Storyboard and ARC in xcode4 and then open that project in xcode5 .
Xcode 4 had the "Use Storyboards" checkbox when you created a new project. It is possible to grab the old Xcode 4 application templates (XML files) and convert them to Xcode 5. That way, you get the old templates back that let you choose whether you want storyboards or not.
I wrote a script that does all that work for you: https://github.com/jfahrenkrug/Xcode4templates
After running the script, you will have an "Xcode 4" section in the "New Project" screen:
And then - Alas! - you get your beloved choices back:
이 스크립트를 사용하려면 http://developer.apple.com/ios 에서 Xcode 4 .app 번들 사본이 필요합니다 .
팁이 있습니다.
- 첫 번째 : XCode 4.6으로 프로젝트를 만듭니다 (이 버전은 XCode 5에 가장 가깝기 때문에).
- 물론 XCode 4.6에서는 ARC, Storyboard를 사용하거나 사용하지 않을 수 있습니다.
- 두 번째 : 그 후 XCode 5로 프로젝트를 열 것입니다. => Xcode 5는 프로젝트가 비 ARC를 사용하고 있으며 스토리 보드가 없다는 것을 이해할 것이라고 생각합니다.
나는 당신의 프로젝트가 작동하기를 바랍니다! :디
참고 URL : https://stackoverflow.com/questions/17234172/xcode-without-storyboard-and-arc
'IT story' 카테고리의 다른 글
기본 키 또는 고유 인덱스? (0) | 2020.07.20 |
---|---|
워킹 비누 클라이언트 예제 (0) | 2020.07.20 |
폴더에 대한 eslint 규칙을 사용하지 않도록 설정 (0) | 2020.07.20 |
모델에 특정 열 / 속성이 있는지 확인하는 방법? (0) | 2020.07.20 |
웹 애플리케이션이 iOS 기기에 푸시 알림을 보내려면 어떻게해야합니까? (0) | 2020.07.20 |