Question

I simply want to display a "CreditsView". So if i press a button show a credits view, press ok the view will 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.

Was it helpful?

Solution

To go back you simply call:

- (IBAction)switchToBaseView:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

OTHER TIPS

To switch back do this

[self.view removeFromSuperview]; And then free the view if you want. [self release];

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top