i'm using iOS 7 Custom transition to present a UINavigationController. but there is a problem. while its animating, the size of navigation bar is only 44points. then after done animating, navigation controllers figured out there is a status bar, so its added 20points for status bar.
my question is, is there possible to set navigation bar to 64point when its animating, so it doesn't change anymore when its done animating.
please see it here for more detail Custom View Transitions
This is my custom animation code:
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{
UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
CGRect finalFrame = [transitionContext finalFrameForViewController:toViewController];
UIView *containerView = [transitionContext containerView];
CGRect screenBounds = [[UIScreen mainScreen] bounds];
toViewController.view.frame = CGRectOffset(finalFrame, 0, screenBounds.size.height);
[containerView addSubview:toViewController.view];
NSTimeInterval duration = [self transitionDuration:transitionContext];
[UIView animateWithDuration:duration delay:0.0 usingSpringWithDamping:0.6 initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
toViewController.view.frame = finalFrame;
} completion:^(BOOL finished) {
[transitionContext completeTransition:YES];
}];
}
UPDATE: somebody fixed this problem. but pretty hacky. add this code after added toViewController.view to containerView.
if ([toViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController* navigationController = (UINavigationController*) toViewController;
UINavigationBar* bar = navigationController.navigationBar;
CGRect frame = bar.frame;
bar.frame = CGRectMake(frame.origin.x, frame.origin.y + 20.0f, frame.size.width, frame.size.height);
}
is there a better way to do it?