I am presenting a modalviewcontroller from another modalviewcontroller. When I dismiss the second modalviewcontroller both the first and second modalviewcontroller should ge
The dismissModalViewControllerAnimated: method is part of the UIViewController class, not the of UIView. So you need to do
UIViewController
UIView
[self.parentViewController dismissModalViewControllerAnimated:YES];
instead of calling it on self.view.superview.
self.view.superview