Search code examples
iosmodalviewcontroller

dismissViewControllerAnimated: completion: has no effect


Has anyone seen this before? In the iPad simulator, I have an About view controller. I want to present it modally, and have the user click a close button.

To complicate it a bit, I have a main View Controller, that presents an iAd banner and a "Main Menu" view controller. The button is on the main menu, and so the IBAction is sent to the Main menu view controller.

In the Main Menu VC, I have a property pointing to the app View Controller, so I call:

AboutViewController *about = [[AboutViewController alloc] initWithNibName:....];
about.callingViewController = viewController;
[viewController presentViewController:about animated:YES completion:nil];

So then in the About View Controller, I have an IBAction that dismisses it:

- (void) dismissAbout:(id)sender
{
    [callingViewController dismissViewControllerAnimated:YES completion:nil];
}

When the dismissAbout is called, nothing happens - the view doesn't go away, and no output in the debugger console. Any ideas?


Solution

  • IBAction should be

    - (IBAction) dismissAbout:(id)
    

    secondly you are dimissing the aboutController so should use self instead of callingViewController