dismissModalViewControllerAnimated:
method is deprecated in iOS 6.0. why don't try with dismissViewControllerAnimated:completion:
How to dismiss a view controller and return to it's parent view controller?
-
26-06-2022 - |
Question
I have a popup view from another view controller with an XIB file. It launches from a parent VC (detailViewController
) and but the dismiss code is within its own VC (KNThirdViewController
)
I'm using this code: https://github.com/kentnguyen/KNSemiModalViewController/blob/master/KNSemiModalViewControllerDemo/KNThirdViewController.xib
When this is called from (KNThirdViewController
)
- (IBAction)dismissButtonDidTouch:(id)sender {
[self dismissModalViewControllerAnimated:NO];
}
The app returns to the rootViewController
and not the detailViewController
. It should simply dismiss itself (the KNThirdViewController
popup VC) and return the user to detailViewController
.
The view controller is presented with:
-(void)scriviBtnPress {
// You can also present a UIViewController with complex views in it
// and optionally containing an explicit dismiss button for semi modal
[self presentSemiViewController:semiVC withOptions:@{
KNSemiModalOptionKeys.pushParentBack : @(YES),
KNSemiModalOptionKeys.animationDuration : @(0.5),
KNSemiModalOptionKeys.shadowOpacity : @(0.3),
}];
}
Solution 2
OTHER TIPS
Try like this :
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow