I intend to dismiss my current UIViewController
and present to a new UIViewController
.
I used the following code
let newViewController: ViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ViewController") as! ViewController
self.presentViewController(newViewController, animated: false, completion: {
self.dismissViewControllerAnimated(false, completion: nil)
})
It gave the following error
2016-06-04 11:40:59.864 myApp[851:117649] Trying to dismiss the
presentation controller while transitioning already. (<_UIFullscreenPresentationController: 0x1703e6900>) 2016-06-04 11:40:59.878 ePassBook[851:117649] transitionViewForCurrentTransition is not set, presentation controller was dismissed during the presentation? (<_UIFullscreenPresentationController: 0x1703e6900>)
Use this Code,
Objective C Code:
[self.navigationController presentViewController:newViewController animated:NO completion:^{
dispatch_after(0, dispatch_get_main_queue(), ^{
[self.navigationController dismissViewControllerAnimated:NO completion:nil];
});
}];
Swift Code:
self.navigationController?.presentViewController(newViewController, animated: false, completion: { () -> Void in
dispatch_after(0, dispatch_get_main_queue(), { () -> Void in
self.navigationController?.dismissViewControllerAnimated(false, completion: nil)
})
})
hope its helpful
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