gpt4 book ai didi

ios - 为什么我无法使用 [transitionContext viewControllerForKey :UITransitionContextFromViewKey] 获取 FromVC 和 ToVC

转载 作者:行者123 更新时间:2023-11-29 00:18:51 25 4
gpt4 key购买 nike

我遇到了一个问题:

当我尝试覆盖方法 startInteractiveTransition: 时,我尝试保存 transitionContext,并获取 FromVCToVC来自 transitionContext但是失败了,不知为什么?有人有想法吗?

代码如下:

-(void)startInteractiveTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
self.transitionContext = transitionContext;
id<UIViewControllerContextTransitioning> transitionContext01 = self.transitionContext;
if (self.transitionContext) {
NSLog(@"start里为空");
}else
{
NSLog(@"start里不为空");
}
NSLog(@"执行了start");
UIViewController * fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewKey];
if (fromVC) {
NSLog(@"start里fromVC为空");
}else
{
NSLog(@"start里fromVC不为空");
}
UIViewController * toVC = [transitionContext viewControllerForKey:UITransitionContextToViewKey];
if (toVC) {
NSLog(@"start里toVC为空");
}else
{
NSLog(@"start里toVC不为空");
}
[[transitionContext containerView] bringSubviewToFront:fromVC.view];
toVC.view.alpha = self.behindViewAlpha;
}

截图如下: screenshot

最佳答案

自己找issur不是UITransitionContextToViewKey但是UITransitionContextToViewControllerKey

关于ios - 为什么我无法使用 [transitionContext viewControllerForKey :UITransitionContextFromViewKey] 获取 FromVC 和 ToVC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44549599/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com