1

When transitioning from full screen to half screen on an iPad 9G, add and remove views in the method:

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {

    UIViewController *VC = self.playerAdapterParentViewController;
    UIView *superview = ((BBLiveRoomCoordinatorViewControllerHD *)self.playerAdapterParentViewController).roomHierarchyManager.playerLifeCycle.superview;
    NSLog(@"zhaofei_superview_trans: %p", superview);
    [targetView removeFromSuperview];
    [superview insertSubview:targetView atIndex:self.playerAdapterViewIndex];
    [VC addChildViewController:self.playerAdapter];
    {
        MASConstraintMaker *make = [targetView mas_makeConstraints];
        if (make) {
            make.edges.equalTo(superview);
            [make install];
        }
    }
    [superview layoutIfNeeded];
}

will result in a crash at

[superview insertSubview:targetView atIndex:self.playerAdapterViewIndex];

Error type:UIViewControllerHierarchyInconsistency

error message:child view controller:<BBLivePlayerAdapter: 0x1231ffc00> should have parent view controller:<BBLiveRoomCoordinatorViewControllerHD: 0x14181ca00> but requested parent is:<BBLiveRoomCoordinatorViewControllerHD: 0x148011600> how can i resolve it.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.