Thursday, April 28, 2011

Modal View not being removed from stack

I am creating a modal view which is opened using the following code

[[self navigationController] presentModalViewController:registrationController animated:NO];

And until recently the following code was used to hide it on a button press

[self dismissModalViewControllerAnimated:YES];

However for some reason that line is no longer removing the view and no errors are presented.

I have also tried

[self.view removeFromSuperView];

But that just leaves me with a completely white screen

Any suggestions on how I go about debugging this issue will be great as Im stumped

From stackoverflow
  • Assuming your controller is a subclass of UIViewController, then inside the modal view controller:

    [self.parentViewController dismissModalViewControllerAnimated:YES];
    
    tigermain : unfortunately that has made no difference either, it just doesnt want to remove from the stack :(
  • I worked out the problem I was updating the Navigation Controller after loading the modal in order to change the style, changing the order solved the problem

    freespace : Since I didn't solve your problem, you should unaccept my answer, and accept your own.
    tigermain : actually yours is a valid answer to the question, but my situation is not completely outlined in the question so I feel yours is more appropriate, thanks for the honesty though
    freespace : re: honesty: one has to sleep at night :)

0 comments:

Post a Comment