I am working on iPhone application using Objective C. As I need to dismiss two UIViewControllers at once, so I am using below code :
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
This code is working fine in iOS6 and iOS7, but it is not working in iOS8. I have checked by using breakpoint, my ViewController viewDidLoad and viewWillAppear method is calling but my view is not loading at all, so as an output, I am getting blank white screen. Can anyone please help me that for iOS8, how can I solve this problem, should I need to use presentedViewController instead of presentingViewController?
Swift code
@IBAction func goBack(sender: AnyObject) {
var tmpController :UIViewController! = self.presentingViewController;
self.dismissViewControllerAnimated(false, completion: {()->Void in
println("done");
tmpController.dismissViewControllerAnimated(false, completion: nil);
});
}
Sample project
- (IBAction)goBack:(id)sender {
UIViewController *trmpVC = self.presentingViewController;
[self dismissViewControllerAnimated:NO completion:^{
[trmpVC dismissViewControllerAnimated:NO completion:nil];
}];
}
Sample project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With