UIViewControllerContext initalFrameForViewController & finalFrameForViewController shows 0 for all values

I implement my own custom transition UIViewController, and when I output the TO View controller frame to the debugger, I get {{0, 0}, {0, 0}}both the initial and final frames. I thought that this method in the context should show the expected frame after the transition for the final and initial frame before the transition.

Is this the way it should work?

-(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));
}

The debugger shows: initialToFrame: {{0, 0}, {0, 0}}, finalToFrame: {{0, 0}, {0, 0}}


In addition, the debugger also shows the following warning. Does this contribution make a mistake anyway?

Presenting view controllers on detached view controllers is discouraged

+3
source share
1 answer

, , , : , toVC.vew - .

, modalPresentationStyle UIModalPresentationFullScreen ( ) UIKit , toVC.view , -finalFrameForViewController:toVC frame: .

modalPresentationStyle = UIModalPresentationCustom, , , : toVC.view fromVC.view (, , fromCV.view ), toVC.view fromVC.view, , -finalFrameForViewController: CGRectZero.

CGRectZero: ", , , , ".

: http://es.slideshare.net/Split82/custom-uiviewcontroller-transitions

, .

+1

All Articles