views:

45

answers:

1

I am trying to present a modal view in a tabbar app. I am using the code

- (IBAction)newView { [self.viewController presentModalViewController:viewController animated:YES]; }

linked to a button. When the button is pressed, nothing happens and nothing is displayed on the log. This is most likely simple to fix, but I have not found anything that has worked yet.

Thanks

A: 

Use this and you rock:

[self presentModalViewController:viewController animated:YES];
Time Machine
Thanks. I'm new to using modal views, so maybe you can help me with this: With the new code, my app is crashing when the action is run. This is the log message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target. Thank you for your help.
MN
You have to init the viewcontroller first: viewController = [[myViewControllerClass alloc] init];
Time Machine