作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我模态地呈现了一个登录屏幕,如下所示。如果我不对,请纠正我。
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"login"];//LOOK AT NEXT LINE
[self presentViewController:ivc animated:YES completion:nil];
确实出现了登录屏幕,但动画是向上滑动的。我更喜欢淡入淡出我们的动画。我该怎么做?
最佳答案
只需为 viewController 设置 modalTransitionStyle
属性。 ( Documentation )
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"login"];
[ivc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:ivc animated:YES completion:nil];
在 Swift 中:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "login")
viewController.modalTransitionStyle = .crossDissolve
present(viewController, animated: true, completion: nil)
关于ios - 使用淡入动画呈现模态视图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30996195/
我是一名优秀的程序员,十分优秀!