Skip to content

Instantly share code, notes, and snippets.

@haxpor
Created August 20, 2016 09:14
Show Gist options
  • Save haxpor/9ec0a7ba145d717be041cfc9dd4dde63 to your computer and use it in GitHub Desktop.
Save haxpor/9ec0a7ba145d717be041cfc9dd4dde63 to your computer and use it in GitHub Desktop.
Code to manually create UIWindow, and UIViewController with customized UIView without involving with Interface Builder
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
CGRect screenRect = [UIScreen mainScreen].bounds;
self.window = [[UIWindow alloc] initWithFrame:screenRect];
GLView *glView = [[GLView alloc] initWithFrame:screenRect];
UIViewController *rootVc = [[UIViewController alloc] init];
[rootVc.view addSubview:glView];
self.window.rootViewController = rootVc;
[self.window makeKeyAndVisible];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment