我正在实现自己的自定义UIViewController
转换,当我将 TO View Controller 的帧输出到调试器时,我会收到{{0, 0}, {0, 0}}
初始帧和最终帧。我认为上下文中的方法应该显示最终转换后的预期帧,以及转换前的初始帧。
这是它应该如何工作的吗?
-(void)startInteractiveTransition:(id<UIViewControllerContextTransitioning>)transitionContext{
UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
CGRect initialToFrame = [transitionContext initialFrameForViewController:toVC];
CGRect finalToFrame = [transitionContext finalFrameForViewController:toVC];
NSLog(@"initialToFrame: %@, finalToFrame: %@", NSStringFromCGRect(initialToFrame), NSStringFromCGRect(finalToFrame));
}
调试器显示:
initialToFrame: {{0, 0}, {0, 0}}, finalToFrame: {{0, 0}, {0, 0}}
此外,调试器还显示以下警告。这是否会导致错误?
Presenting view controllers on detached view controllers is discouraged