CT-3262 Payment Methods rotation layout issues - #344
Conversation
Restores missing branch for portrait in updateLayoutForCurrentOrientation.
After orientation changes, it forces layout and re-runs viewModelNeedsUpdate so the header frame, table inset, and aspect-ratio-based constraints match the new screen size after rotation.
| CGFloat headerHeight = kPortraitHeaderHeight * getWidthAspectRatio(); | ||
| self.headerView.frame = CGRectMake(0, 0, screenWidth, headerHeight); | ||
| self.tableView.contentInset = UIEdgeInsetsMake(kPortraitContentInset * getWidthAspectRatio(), 0, 0, 0); | ||
| } |
There was a problem hiding this comment.
Fix for corrupted Card layout on top, when being rotated from landscape to portrait.
|
|
||
| [self.paymentStackView addArrangedSubview:self.payButton]; | ||
| [self.payButton.widthAnchor constraintEqualToConstant:kHeaderPaymentButtonHeight * getWidthAspectRatio()].active = YES; | ||
| [self.payButton.widthAnchor constraintEqualToConstant:paymentButtonWidth].active = YES; |
There was a problem hiding this comment.
Fix for inconsistent width of the button in landscape (depending whether it's been opened in landscape or switched to landscape from portrait).
| - (void)prepareForOrientationChange { | ||
| [_cardHeaderView removeFromSuperview]; | ||
| _cardHeaderView = nil; | ||
| } |
There was a problem hiding this comment.
Removes leftover pieces of the top card in landscape (it was hidden correctly when opened in landscape, but leaving rubbish after rotation).
| // Re-runs configureWithViewModel so header constraints pick up the new screen aspect ratio. | ||
| [self.presenter viewModelNeedsUpdate]; | ||
| }]; | ||
| } |
There was a problem hiding this comment.
Fixes incorrect Paym. Methods UI proportions after rotation.
It forces layout and re-runs viewModelNeedsUpdate so the header frame, table inset, and aspect-ratio-based constraints are recalculated properly for new orientation.
It's been causing an unwanted space gap in headerview sometimes.
|


Demo:
Before:
https://github.com/user-attachments/assets/4610ba12-01a6-49be-a52d-59c415745e10
After:
https://github.com/user-attachments/assets/ece4babb-2897-4e34-8663-4a02840f04a7