Skip to content

CT-3262 Payment Methods rotation layout issues - #344

Open
RafalOzogJudopay wants to merge 10 commits into
masterfrom
CT-3262-payment-methods-layout-issues-on-rotation
Open

CT-3262 Payment Methods rotation layout issues#344
RafalOzogJudopay wants to merge 10 commits into
masterfrom
CT-3262-payment-methods-layout-issues-on-rotation

Conversation

@RafalOzogJudopay

@RafalOzogJudopay RafalOzogJudopay commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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];
}];
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@RafalOzogJudopay RafalOzogJudopay changed the title DRAFT CT-3262 Payment Methods rotation layout issues CT-3262 Payment Methods rotation layout issues Jul 21, 2026
@stefan-tudor

Copy link
Copy Markdown
Contributor

I noticed this in the console. Can you have a look, please, @RafalOzogJudopay ?

Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x1186585f0 h=--& v=--& JPPaymentMethodsHeaderView:0x110fa9400.height == 140.7   (active)>",
    "<NSLayoutConstraint:0x1173996d0 UIView:0x110cf0fc0.height == 90   (active)>",
    "<NSLayoutConstraint:0x1184b9bd0 H:|-(0)-[UIView:0x110d47100]   (active, names: '|':JPCardView:0x110d46840 )>",
    "<NSLayoutConstraint:0x1184b99f0 UIView:0x110d47100.trailing == JPCardView:0x110d46840.trailing   (active)>",
    "<NSLayoutConstraint:0x1184ba2b0 JPCardView:0x110d46840.width == 1.715*JPCardView:0x110d46840.height   (active)>",
    "<NSLayoutConstraint:0x1173997c0 UIView:0x110cf0fc0.bottom == JPPaymentMethodsHeaderView:0x110fa9400.bottom   (active)>",
    "<NSLayoutConstraint:0x117399680 V:|-(0)-[UIView:0x110cf1180]   (active, names: '|':JPPaymentMethodsHeaderView:0x110fa9400 )>",
    "<NSLayoutConstraint:0x1173995e0 UIView:0x110cf1180.bottom == UIView:0x110cf0fc0.top   (active)>",
    "<NSLayoutConstraint:0x1184b8e60 V:|-(263.889)-[JPCardView:0x110d46840]   (active, names: '|':JPPaymentMethodsCardHeaderView:0x110d464c0 )>",
    "<NSLayoutConstraint:0x1184b9220 JPCardView:0x110d46840.bottom == JPPaymentMethodsCardHeaderView:0x110d464c0.bottom   (active)>",
    "<NSLayoutConstraint:0x1184b88c0 V:|-(0)-[JPPaymentMethodsCardHeaderView:0x110d464c0]   (active, names: '|':UIView:0x110cf1180 )>",
    "<NSLayoutConstraint:0x1184b9360 JPPaymentMethodsCardHeaderView:0x110d464c0.bottom == UIView:0x110cf1180.bottom   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1184b99f0 UIView:0x110d47100.trailing == JPCardView:0x110d46840.trailing   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

And the landscape mode is not looking good on iPhone 17 Pro, iOS 26.4

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-08-10.at.16.26.08.mov

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16 Security Hotspots
13.5% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants