在导航中包含导航栏

时间:2014-04-01 01:36:41

标签: ios animation

我正在创建一个动画,当前视图控制器向下滑动,显示其下方的新视图控制器。我已将此工作与视图一起使用,但我想在视图中向下滑动包含导航控制器。因此,如果没有导航栏向下滑动视图,它将向下滑动,顶部有导航栏。我该如何解决这个问题。以下是我使用视图的方式:

- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext
{
    return 5.00;
}

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
    UIViewController* toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
    UIViewController* fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
    [[transitionContext containerView] addSubview:fromViewController.view];
    toViewController.view.frame = CGRectMake(0, 0, 320, 568);

    [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
        fromViewController.view.frame = CGRectMake(0, 2000, 320, fromViewController.view.frame.size.height);
        toViewController.view.frame = CGRectMake(0, 0, 320, fromViewController.view.frame.size.height);
    } completion:^(BOOL finished) {
        fromViewController.view.transform = CGAffineTransformIdentity;
        [transitionContext completeTransition:![transitionContext transitionWasCancelled]];

    }];

}

0 个答案:

没有答案