Kevin
Kevin

Reputation: 291

how to change first loading view

I got this code on didFinishLaunching but I don't know how to customize it to open up menuViewController from when I open the app.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];


self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
// At the end of applicationDidFinishLaunching, right before 
// the return YES
[[GCTurnBasedMatchHelper sharedInstance] authenticateLocalUser];
return YES;
}

hope someone can help me out

Upvotes: 0

Views: 203

Answers (3)

Change the following line

self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];

to

self.viewController = [[[menuViewController alloc] initWithNibName:@"menuViewController" bundle:nil] autorelease];

Upvotes: 1

JainAnk
JainAnk

Reputation: 204

Create the object of menuViewController assign this controller to rootViewController.

self.viewController = [[[MenuViewController alloc] initWithNibName:@"menuViewController" bundle:nil] autorelease];  

self.window.rootViewController = self.viewController; 
[self.window makeKeyAndVisible]; 

Upvotes: 0

Dima
Dima

Reputation: 23634

The line you need to change is

self.window.rootViewController = self.viewController;

To

MenuViewController *menuViewController = [[[MenuViewController alloc] init] autorelease];
self.window.rootViewController = menuViewController;   

This is assuming you have a custom view controller called MenuViewController

Upvotes: 0

Related Questions