I presented a login screen as follows modally. Correct me if I am not right.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"login"];//LOOK AT NEXT LINE [self presentViewController:ivc animated:YES completion:nil];
The login screen does appear but the animation is a slide up one. I prefer a fade in and fade our animation. How can I do this?
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)
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