带有自定义动画的屏幕弹出控制器时出现黑色效果? [英] Black effect when screen popping controller with custom animation?

查看:24
本文介绍了带有自定义动画的屏幕弹出控制器时出现黑色效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从导航控制器弹出一个视图控制器.当我弹出控制器时,我想给它动画,比如推视图控制器.为此我使用下面的代码

I am popping a view controller from navigation controller.When i am popping controller i want to give it animation like Pushing a view controller.For that purpose i am using below code

    CATransition* transition = [CATransition animation];
    transition.duration = 0.3f;
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromRight;
    [self.navigationController.view.layer addAnimation:transition
                                                forKey:kCATransition];

    [self.appDelegate setUpForLVC];
    [self.navigationController popViewControllerAnimated:NO];

当动画开始时,我在这里得到黑色效果.请告诉我我的代码有什么问题?

When animation starts i get black effect here.Please tell me what is the issue with my code ?

推荐答案

在 didFinishLaunchingWithOptions 中添加这段代码

add this code in didFinishLaunchingWithOptions

self.window.backgroundColor = [UIColor whiteColor];
self.window.tintColor = [UIColor whiteColor];


      **OR**
2)Set animation duration to 0

这篇关于带有自定义动画的屏幕弹出控制器时出现黑色效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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