【问题标题】:Custom Segue Animation showing black screen自定义 Segue 动画显示黑屏
【发布时间】:2014-05-27 13:00:27
【问题描述】:

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

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];

【问题讨论】:

    标签: ios objective-c uistoryboardsegue catransition


    【解决方案1】:

    我认为你需要保留上下文,试试这个:

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

    【讨论】:

    • 嗨,我在做反向操作时很震惊。我想用我上面讨论过的相同动画从第二个屏幕返回第一个屏幕,但是“第一个屏幕立即出现,然后第一个屏幕的动画慢慢出现并重叠”。我只想在第二个屏幕上为第一个屏幕制作动画
    • 你是怎么做到的?
    • 如何快速做到这一点?
    猜你喜欢
    • 2017-07-26
    • 2017-02-15
    • 2012-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-15
    相关资源
    最近更新 更多