Handling In-Call Status Bar with Custom Modal Presentation

后端 未结 5 804
甜味超标
甜味超标 2021-01-30 13:25

The Problem

I\'ve noticed some strange behavior when presenting a UINavigationController (with a root view controller, already pushed, naturally) with

5条回答
  •  梦如初夏
    2021-01-30 14:29

    I had the same issue and the problem was with the view that I was presenting which was automatically adjusted by 20pt because of in-call bar. However since I insert the view into container, I had to reset the frame to match container's bounds.

    - (void)animateTransition:(id)transitionContext {
        UIView* destinationView = [transitionContext viewForKey:UITransitionContextToViewKey];
        UIView* container = transitionContext.containerView;
    
        // Make sure destination view matches container bounds
        // This is necessary to fix the issue with in-call bar
        // which adjusts the view's frame by 20pt.
        destinationView.frame = container.bounds;
    
        // Add destination view to container
        [container insertSubview:destinationView atIndex:0];
    
        // [reducted]
    }
    

提交回复
热议问题