views:

76

answers:

1

In my .m file :

  • (void)viewDidLoad { [super viewDidLoad];

/* Some codes for picker view and slider */

}

I used a button to navigate to second view by using the below code:

  • (IBAction)goToPlay{ [self presentModalViewController: secondViewController animated: YES]; }

I used another button to go back to first view by using below code:

  • (IBAction)goBack{ [self dismissModalViewControllerAnimated:YES]; } Now the viewDidLoad method is not calling. I had written some codes in viewDidLoad in first view and I want to execute it when pressing goBack button in second view.

What should I do?

Anyone please help.

+2  A: 

Write it in

- (void)viewWillAppear:(BOOL)animated
{

}

method, this would be called every time your view will appear...

mihirpmehta
It worked!!! Thank you very much!!
iSharreth
you are welcome... Make habit of accepting answer which solves your problem... Not doing so decrease your accept rate... and decrease your chances of getting answers...
mihirpmehta