Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

MDMTransitionPresentationController should implement viewWillTransitionToSize #49

Open
jverkoey opened this issue Oct 25, 2017 · 1 comment

Comments

@jverkoey
Copy link
Contributor

frameOfPresentedViewInContainerView is unfortunately only called during the initial presentation of a view controller, meaning a view controller that's presented over part of the screen won't know to update its layout when the device's orientation changes.

To solve this, we can implement viewWillTransitionToSize and invoke _calculateFrameOfPresentedView with the new dimensions. This will allow the block to return a new size for the new dimensions.

Unfortunately, some quick sleuthing revealed that the containerView's frame isn't up-to-date when viewWillTransitionToSize is invoked and, because our block implementations tend to look at the containerView's bounds, most of our layout blocks will probably be wrong.

@ianegordon
Copy link
Contributor

I believe you want to query the frame as you animateAlongsideTransition inside your PresentationController.

-(void)viewWillTransitionToSize:withTransitionCoordinator: {
// Call super ...

[coordinator animateAlongsideTransition: ^() {
// self.contentView.frame should be current now
self.presentedView.frame = [self frameOfPresentedViewInContainerView];
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants