CodeGeek123
CodeGeek123

Reputation: 4501

Presenting Modal View Controller in iOS not working

I need to show another view from rootviewcontroller on button click. I have written the following code but it doesnt work. Any ideas why?

In my app delegate method i have the following code -

- (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 = [[[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil] autorelease];

self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}

Then in my mainviewcontroller i have a button action which is supposed to take me to a different class but it does nothing. Although the button action is working since nslog statements work. Any ideas?

   LoginViewController * loginViewController = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:nil];
   [self.modalViewController presentModalViewController:loginViewController animated:YES];
NSLog(@"HE::P");

Upvotes: 0

Views: 798

Answers (1)

Pierre
Pierre

Reputation: 11673

If you try :

[self presentModalViewController:loginViewController animated:YES];

Upvotes: 2

Related Questions