Created
July 11, 2014 05:39
-
-
Save situee/4a345390dd5224c64107 to your computer and use it in GitHub Desktop.
You would use code something like this to programmatically create a window, install the root view controller, and make the window visible:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/WindowScreenRolesinApp/WindowScreenRolesinApp.html#//apple_ref/doc/uid/TP40012555-CH4-SW1 | |
| // Important: When you create a window programmatically, always set the size of the window to the full bounds of the screen object. | |
| // In particular, don’t reduce the size of the window to accommodate the status bar or any other items. | |
| // If you are using view controllers, the view controller should handle the sizing of your views automatically. | |
| - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
| UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
| myViewController = [[MyViewController alloc] init]; | |
| window.rootViewController = myViewController; | |
| [window makeKeyAndVisible]; | |
| return YES; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment