Reputation: 156
I am trying to go from login screen to signup. But getting error...
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target .'
Login.H
#import "SignupController.h"
@interface LoginController : UIViewController {
IBOutlet SignupController *signupController;
Login.M
(IBAction)signup:(UIButton*) sender
{
NSLog(@"lla");
[self presentModalViewController:signupController animated:YES];
}
Upvotes: 1
Views: 77
Reputation: 1832
if you donot use a nib file:
signupController = [[SignupController alloc] init];
[self presentModalViewController:signupController animated:YES];
if you use a nib file:
signupController = [[SignupController alloc] initWithNibName:@"nib file name with out ext" bundle:nil];
[self presentModalViewController:signupController animated:YES];
Upvotes: 1
Reputation: 5555
you need to allocate and initiate your signupController first.
self.signupController = [[SignupController alloc]initWithNibName:xibname];
[self presentModalViewController:signupController animated:YES];
wheras xibname
is will be the name of your nibfile, somthing like @"signupController"
if your interface file is called signupController.xib
sebastian
Upvotes: 2