-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
@@ -201,7 +201,7 @@ public final class PageViewController: UIViewController { | |||
}() | |||
|
|||
coordinator.animate(alongsideTransition: { _ in | |||
let contentWidth = self.scrollView.bounds.width | |||
let contentWidth = size.width |
There was a problem hiding this comment.
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.bounds
may 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 { |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks 👍 |
I fixed layout-bug after device rotation.