1
votes

I am Using a Navigation based application. However i don't want to push a view. I have changed present ModalViewController. Now, I am confused - how to load previouse view.

  1. My Application's Table View - default in navigation base application
  2. On navigation controller I have added (add employee) button.
  3. On Add(employee) click i have written following code in appDelegate.m -(IBAction)AddClicked:(id)sender { if(self.addData==nil) // addData is a object of my next view { addData=[[AddEmpScrn alloc] initWithNibName:@"AddEmpScrn" bundle:nil] autorelease]; } [self.navigationController presentModalViewController:self.addData animated:YES];
    }

This code works successfully & next Add Employee screen load perfactly.

But Now I am confused.

How to get back to previous view? that is if a user click on "Save" or "Cancel" it should display again the previous view... main screen

I dont know how to solve it...

anybody please help me...

i will be thank full.

2
I've tried to edit for code but the code snippet didn't work.quantumpotato

2 Answers

1
votes

Have u tried using the dismissModalViewController method? should do what you are asking f or

0
votes

Have you read "Using Modal View Controllers"?

If you presentModalViewController then the old view is still there "behind" it. You just need to call dismissModalViewControllerAnimated: on the original navigation controller.

If you are directly manipulating the view hierarchy by swapping out subviews, you will need to hold onto the old view in another member variable and make sure to retain it.