iPhone - presentModalViewController从右侧过渡 [英] iPhone - presentModalViewController with transition from right

查看:149
本文介绍了iPhone - presentModalViewController从右侧过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用presentModalView控制器并通过其控制器将转换推送到新视图。
我正在使用以下代码进行转换(工作正常)

I'm using presentModalView controller and pushing the transition to new view via its controller. And I'm using following code to do the transition (which is working fine)

    [self presentModalViewController:myViewController animated:NO];
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[myViewController.view layer] addAnimation:animation forKey:@"SwitchToView"];  

但问题是,它显示空白屏幕然后转换开始。如何避免这种情况?

but the problem is that, its showing blank white screen and then transition starts. How to avoid this?

推荐答案

首先添加动画然后出现

CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[myViewController.view layer] addAnimation:animation forKey:@"SwitchToView"];  


[self presentModalViewController:myViewController animated:NO];

这篇关于iPhone - presentModalViewController从右侧过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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