使用淡入动画呈现模态视图 [英] Present a modal view using fade-in animation

查看:77
本文介绍了使用淡入动画呈现模态视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按模式提供了一个登录屏幕。如果我不对,请纠正我。

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?

推荐答案

只需设置 modalPresentationStyle modalTransitionStyle viewController的属性。

Just set the modalPresentationStyle and modalTransitionStyle properties for the viewController.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"login"];
[ivc setModalPresentationStyle:UIModalPresentationCustom];
[ivc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:ivc animated:YES completion:nil];

这篇关于使用淡入动画呈现模态视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆