Skip to content

Instantly share code, notes, and snippets.

@keicoder
Last active April 7, 2024 13:08
Show Gist options
  • Save keicoder/8129162 to your computer and use it in GitHub Desktop.
Save keicoder/8129162 to your computer and use it in GitHub Desktop.
objective-c : iOS 7 스토리보드 대신 xib 방식으로 개발하기
//iOS 7 스토리보드 대신 xib 방식으로 개발하기
//solution 1
1. empty application 생성
2. new class file 생성 -> name : ViewController, UIViewController sub class, with XIB check
3. appdelegate 헤더 파일 수정
@class ViewController;
@property (strong, nonatomic) ViewController *viewController;
4. appdelegate m 파일 수정
#import "ViewController.h"
didFinishLaunchingWithOptions: ->
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
//solution 2
1. empty application 생성
2. new class file 생성 -> name : ViewController, UIViewController sub class, with XIB check
3. appdelegate m 파일 수정
#import "ViewController.h"
didFinishLaunchingWithOptions: ->
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
//solution 3
1. single view application 생성
2. remove main.storyboard file from project
3. add new .xib file in Project
4. set Main Interface to your .xib file in "General Tab" on right panel
5. appdelegate m 파일 수정
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment