0

I'm developing a iPhone App, in which I'm changing the ViewController using presentModalViewController method upto 2/3 levels (e.g. Home-->Option-->Other-->More).

Now I want to get my app back to first screen or ViewController. If I use dismissModalViewControllerAnimated method, it just dismisses the current view controller only. But I want to clear the stack and start the Home screen again.

Thanks for any help.

Walid Hossain
  • 2,724
  • 2
  • 28
  • 39

1 Answers1

1

Set the delegates properly for each level. So if you press Cancel or Done in More, it will call somehting like [other moreViewDidCancel] inside of which, you will call dismissModalViewController:Animated: and notify its parent view controller (delegate) that is should dismiss( so, [option otherViewDidCancel]) and so on till the top level.

Michał Zygar
  • 4,052
  • 1
  • 23
  • 36
  • hey..man..although you did answer..i knew that method..but if you could know how to present the home screen without being animated..i had the same problem.what if i just want to come back to main menu...not just playing animation that you ar going back views.. – Shubhank Jan 23 '12 at 10:53
  • you can set `animated` parameter to NO and you will skip the animation – Michał Zygar Jan 23 '12 at 10:55