Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device orientation bug #18

Open
felixolivares opened this issue Sep 8, 2017 · 2 comments
Open

Device orientation bug #18

felixolivares opened this issue Sep 8, 2017 · 2 comments

Comments

@felixolivares
Copy link

Hi there,
I've noticed that there is bug when device orientation comes into place. To reproduce the error select an image from the main view, it takes you to destination controller, then change device orientation and go back, the collection view stays in the previous orientation and do not updates. Could you advice a solution for this problem ?

@acushway
Copy link

acushway commented Feb 8, 2019

I'm seeing this problem as well.

@acushway
Copy link

acushway commented Feb 9, 2019

Not sure how good the solution is, but I fixed this for myself by changing ZoomTransitioning.swift

In animateTransitionForPop under the line that sets containerView:

let containerView: UIView = transitionContext.containerView // under this line

sourceView.frame = containerView.frame

The issue seems to be that sourceView still has its old frame. Setting its frame to be equal to containerView fixed the issue for me.

I also had to update my ZoomTransitionSourceDelegate for the pop case:

I needed to add something like:

func transitionSourceImageViewFrame(forward: Bool) -> CGRect {
if !forward {
UIView.performWithoutAnimation {
view.setNeedsLayout()
view.layoutIfNeeded()
}
}
return transitionView.convert(transitionView.bounds, to view)
}

The key was that the view needed to be laid out again to get things in the correct position for animating back to (in the case that the device had been rotated).

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

No branches or pull requests

2 participants