Hii...i am new to iPhone programming..can anybody help me out please...!! I have multiple viewControllers..in First ViewController called HomeViewController i called the met
According to the doco for dismissModalViewControllerAnimated:
If you present several modal view controllers in succession, and thus build a stack of modal view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack.
So from your ContactUsViewController you need to call dismissViewControllerAnimated on the HomeViewController. You can access that view controller through parentViewController property. So your code in the dismissAction for the ContactUsViewController is:
- (IBAction)dismissAction:(id)sender
{
// get your parent (ie AboutViewController)
UIViewController * parent = self.parentViewController;
// get its parent (ie HomeViewController)
[parent.parentViewController dismissModalViewControllerAnimated:YES];
}
There might be a better way of getting to your HomeViewController, but for your shallow stack of view controllers, this should be fine (I tried this out and it worked).