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

Fix layout bug after device rotation #6

Merged
merged 4 commits into from
Sep 30, 2019

Conversation

shoheiyokoyama
Copy link
Member

I fixed layout-bug after device rotation.

@@ -201,7 +201,7 @@ public final class PageViewController: UIViewController {
}()

coordinator.animate(alongsideTransition: { _ in
let contentWidth = self.scrollView.bounds.width
let contentWidth = size.width
Copy link
Member Author

@shoheiyokoyama shoheiyokoyama Sep 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use transition size because scrollView.boundsmay not be updated in alongsideTransition.

- inset(for: tabViewLayout.leading).left - tabViewLayout.leading.distance
- inset(for: tabViewLayout.trailing).right - tabViewLayout.trailing.distance
let tabViewSize = CGSize(width: tabViewWidth, height: tabViewLayout.height)
if tabViewSize != tabView.bounds.size {
Copy link
Member Author

@shoheiyokoyama shoheiyokoyama Sep 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to call tabView.highlightCells(withRatio:) after tab view frame calculation is finished (e.g. after device rotation), so execute the process in viewDidLayoutSubviews()

Copy link
Member

@KyoheiG3 KyoheiG3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shoheiyokoyama
Copy link
Member Author

Thanks 👍

@shoheiyokoyama shoheiyokoyama merged commit 3e28d38 into master Sep 30, 2019
@shoheiyokoyama shoheiyokoyama deleted the content-size-transitioning branch September 30, 2019 09:56
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

Successfully merging this pull request may close these issues.

2 participants