Present a modal view using fade-in animation
Just set the modalTransitionStyle
property for the viewController. (Documentation)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"login"];
[ivc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:ivc animated:YES completion:nil];
In Swift:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "login")
viewController.modalTransitionStyle = .crossDissolve
present(viewController, animated: true, completion: nil)
Swift 3, 3.1, 4, 4.2 (as of January, 2021)
var storyboard = UIStoryboard(name: "Main", bundle: nil)
var loginViewController = storyboard.instantiateViewController(withIdentifier: "login")
loginViewController.modalTransitionStyle = .crossDissolve
self.present(loginViewController, animated: true, completion: nil)
You have to set prestentation and transition style:
self.activityAlertVC.modalPresentationStyle = .custom
self.activityAlertVC.modalTransitionStyle = .crossDissolve