xcode5는 스토리보드를 사용하지 않습니다

8107 단어 Xcode5스토리보드
빈 응용 프로그램으로 프로젝트를 만들고 모든 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;}
아크 제거 단계
1) 빌드 설정에서 자동 참조 카운팅을 NO로 설정합니다.
///////////////////////////////////////////////////////////////////////END///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
스토리보드와 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) 빌드 설정에서 자동 참조 카운팅을 NO로 설정합니다.
ARC 제거: 빌드 설정 -> Objective-C 자동 참조 계산 -> 아니요로 이동합니다.

좋은 웹페이지 즐겨찾기