views:

463

answers:

3

Hey,

sorry for the question but i dont found any working solution.

I simple want to display a "CreditsView". So if i press a button show a credits view, press ok view disappear.

I have my base controller and my credits view controller and now i try something like:

- (IBAction)switchToCreditsView:(id)sender {
creditsViewController = [[CreditsViewController alloc] initWithNibName:@"CreditsViewController"];
[self.view addSubview:creditsViewController.view];
//[self presentModalViewController:creditsViewController animated:YES];

}

But if i press the Button my app crashed.

Thanks for your help!

+1  A: 

ok this works for me

- (IBAction)switchToCreditsView:(id)sender {
creditsViewController = [[CreditsViewController alloc] init];
[self presentModalViewController:creditsViewController animated:YES];

}

But how can i switch back?

- (IBAction)switchToBaseView:(id)sender {
BaseViewController *viewController = [[BaseViewController alloc] init];
[self presentModalViewController:viewController animated:YES];

}

Doesn't work...

phx
+1  A: 

Don't apologize for asking questions :)

To go back you simply call:

- (IBAction)switchToBaseView:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}
Tom van Zummeren
Sometimes the questions seems to stupid to ask ;)Thanks, it works now!(switchToBaseView has to be placed in the CreditsViewController, just to complete this here :) )
phx