Posted By

matryer on 02/06/10


Tagged

xcode iphone iPad AppDelegate


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

umang_nine
bobbym245
cnathan


didFinishLaunchingWithOptions method that just creates a custom UIViewController


 / Published in: Objective C
 

Inside the AppDelegate, the didFinishLaunchingWithOptions method can be used to just create and use a custom View Controller class.

  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  2.  
  3. // create an instance of the view controller
  4. MyViewController *vc = [[MyViewController alloc] init];
  5.  
  6. // add the view controllers view to the window
  7. [window addSubview:[vc view]];
  8.  
  9. // release vc (we're done with it)
  10. [vc release];
  11.  
  12. // make key and visible of course!
  13. [window makeKeyAndVisible];
  14.  
  15. // happy times
  16. return YES;
  17. }

Report this snippet  

You need to login to post a comment.