I have an app with two (2) XIB files; one is the main view, the other is a help view. I have view controllers created for both. I have a button on the main view XIB that calls the help view which works like this:
- (IBAction)bDisplayHelp:(UIButton *)sender {
HelpViewController *svc = [HelpViewController new];
svc = [[HelpViewController alloc] initWithNibName:@"HelpViewController" bundle:nil];
[self.view addSubview: svc.view];
}
On the Help view, I have a button which I want to take the user back to the Main view. This is my code (which is not working):
- (IBAction)bBackToMainNib:(UIButton *)sender {
MainViewController *tvc = [MainViewController new];
tvc = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
[self.view addSubview: tvc.view];
}
All I did was essentially go back and forth. I'm getting this error at runtime when I attempt to return to the Main view (doesn't execute the first statement, just crashes):
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString bBackToMainNib:]: unrecognized selector sent to instance 0x7d3586b0'
What am I doing wrong?
0 comments:
Post a Comment