I presented a view controller using presentModalViewController:
, now how to close/dismiss it?
For iOS6 use this code
[self dismissViewControllerAnimated:YES completion:Nil];
instead of
[self dismissModalViewControllerAnimated:YES];
This may help you.
You have two choices, both involves using dismissModalViewController.
The preferred way is to use delegation and tell the view controller who was responsible for presenting the view to dismiss it. The other way is to have the view who was presented to dismiss itself (which actually asks the parent to dismiss it.)
From the controller presented modally:
[self dismissModalViewControllerAnimated:YES]