tags:

views:

26

answers:

3

I have viewBased Application, i have 3 view controller in that.
When I want to go back to first view from second view, I want that view to be reloaded from start.
Code I use to dismiss the present view is:

//Back Button Code:   

[self dismissModalViewControllerAnimated:YES];    

//Code I use to go to new view is:   

[self presentModalViewController:secondView animated:YES];
A: 

When I want to go back to first view from second view, I want that view to be reloaded from start.

Wich one?


Well I think it should work since dismissing a modal dialog unloads it. What happens exactly that you don't want? You must have retained something you don't want to.

gurghet
First View I want to load from start when I am going back from second view..I added the code also.
Akki
+2  A: 

I am not getting what you trying to do... put your logic inside viewWillAppear method... which gets called everytime view Loads..

KiranThorat
I have nothing in viewWillAppear..I have all my logic in button press function.
Akki
Okk.. so when you click on the button you want to load the same view from start ??
KiranThorat
Yea. Suppose I have textfield and I want it to be blank again at the start
Akki
set the textfield.text to empty string in viewwillappear...
KiranThorat
A: 

It's not clear if you want your first view to restart, or your second view to restart.

Answer for both cases:

If you want view 1 to restart, move the code you need re-executed into viewWillAppear()

If you want view 2 to restart, it's been released from memory so going back to it will call viewDidLoad() and restart it anyway.

Hope that helps....

Siddharth Iyer