I implement peek and pop to view photos.
I set the option to view the view in PDF to fit the photo in
- (UIViewController*)previewingContext:viewControllerForLocation:
Everything looks fine:

And just click it as viewControllerToCommit in
- (void)previewingContext: commitViewController:
But when I commit pop, I get a view controller with the wrong size:

Typically, a view controller should look like this:

I tried setting the frame size and preferredSize to
- (void)previewingContext: commitViewController:
but still not working.
To avoid this, I should not install preferredContentSize or create a new view controller without installing preferredContentSize, and this is not ideal.
Am I doing something wrong here?
source
share