Prevent STPPaymentMethodTableViewCell.titleLabel
from overlapping checkmark
#952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Previous layout code allowed the
titleLabel
to be as wide as it wanted, even ifthat ran offscreen. Fixing it to explicitly constrain the
titleLabel
to be betweenthe
leftIcon
andcheckmarkIcon
, with horizontal spacing ofpadding
.Instead of asking UIKit to calculate the height that the
titleLabel
should be, just usethe full height of the cell. We get the same vertical centering, and similarly prevents
the label from exceeding the bounds of the cell.
Motivation
Fixes #948
Testing
Tested using the sample app against iPhone 5-width devices, and used our snapshot tests
to check for regressions.
The snapshot tests do show slight differences in how the
titleLabel
renders. I believeit's now pixel aligning the text. When I compare before/after, especially on something
like the
E
inEnding In
(it's true of all the letters, but really apparent onE
),the old snapshot has anti-aliased top/bottoms, where the new snapshot has crisp lines.
This is subtle enough that I hadn't noticed it previously, but I think it's a nice,
unexpected bonus.