3D Touch, Peek & Pop with different frame size

557 Views Asked by At

I implement the peek & pop for my photo view.

I set the peek view controller's preferredSize to fit the photo in

- (UIViewController*)previewingContext:viewControllerForLocation:

It looks OK:

enter image description here

And just push it as the viewControllerToCommit in

- (void)previewingContext: commitViewController:

But when I commit the pop, I get a view controller with wrong size: enter image description here

Normally the view controller should look like this:

enter image description here

I tried to set the frame size and preferredSize in

- (void)previewingContext: commitViewController:

but still not works.

To avoid this, I must not set the preferredContentSize, or instantiate a new view controller without setting the preferredContentSize, neither is perfect.

Am I doing any thing wrong here?

0

There are 0 best solutions below