我试图关注这个问题:Presenting a UINavigationController in a custom modal,但我的导航栏在动画后从64p缩小到44p。我使用的是自定义UIPresentationController
和UIViewControllerAnimatedTransitioning
。
我认为问题在于以下代码。当我注释掉动画时,导航栏开始并保持在44p
func animatePresentationWithTransitionContext(transitionContext: UIViewControllerContextTransitioning) {
let presentedController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)! as DrawerNavigationController
let presentedControllerView = transitionContext.viewForKey(UITransitionContextToViewKey)!
let containerView = transitionContext.containerView()
var finalFrame = transitionContext.finalFrameForViewController(presentedController)
presentedControllerView.frame = CGRectOffset(finalFrame, 0, containerView.bounds.size.height)
containerView.addSubview(presentedControllerView)
UIView.animateWithDuration(self.duration, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.0, options: .AllowUserInteraction, animations: {
var height = presentedController.height()
presentedControllerView.frame.origin.y = containerView.bounds.size.height - height
}, completion: {(completed: Bool) -> Void in
transitionContext.completeTransition(true)
})
}