自定义Segue动画显示黑屏 [英] Custom Segue Animation showing black screen

查看:132
本文介绍了自定义Segue动画显示黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用自定义segue呈现 destinationViewController 时,我遇到了一个新问题,在转换过程中,源代码 ViewController 更改为黑屏,我需要将屏幕保持原状(我的设计)。

I am struck with a new problem, on presenting the destinationViewController using custom segue, during transition the source ViewController is changed to black screen, i need the screen to be as it is (my design).

UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController][screenshot][1]

CATransition* transition = [CATransition animation];
transition.duration = 0.1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromRight; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom


[destinationController.view.layer addAnimation:transition forKey:kCATransition];
[sourceViewController presentViewController:destinationController animated:NO completion:nil];


推荐答案

我认为您需要保留上下文,请尝试:

I think you need to keep the context, try this:

    UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
    rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
    UIViewController *destinationController = (UIViewController*)[self destinationViewController]
    [sourceViewController presentViewController:destinationController animated:NO completion:nil];

这篇关于自定义Segue动画显示黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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