Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dismissViewControllerAnimated is called but ViewController is not dismissed

I am having a problems with the dismissViewControllerAnimated method not closing down the view.

What is happening in the app here is:

  • Cell in ItemViewController is selected.
  • View is pushed to ItemDetailViewControllerand details are sent through a delegate
  • User selects 'done' and the event is sent via a delegate to be closed in ItemViewController

All of this works except for the View is not dismissed, there are no errors. Can anyone see what is wrong?

- (void)itemDetailViewControllerDidFinish:(ItemDetailViewController *)controller {     NSLog(@"Controller: %@", controller);     // Returns - Controller: <ItemDetailViewController: 0x6b68b60>      [self dismissViewControllerAnimated:YES completion:nil]; } 
like image 611
Ad Taylor Avatar asked Jan 24 '12 15:01

Ad Taylor


People also ask

How do I dismiss a presented Viewcontroller?

When it comes time to dismiss a presented view controller, the preferred approach is to let the presenting view controller dismiss it. In other words, whenever possible, the same view controller that presented the view controller should also take responsibility for dismissing it.


1 Answers

What if you call [controller.navigationController popViewControllerAnimated:YES] instead?

For that matter, what if you call [controller dismissViewControllerAnimated:YES completion:nil] instead of calling it on self?

like image 129
Nick Lockwood Avatar answered Oct 05 '22 14:10

Nick Lockwood