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

UL&S: bug fix: make the TextLinkButtonTableViewCell button word wrap, not truncate #310

Merged
merged 3 commits into from
Jun 26, 2020

Conversation

mindgraffiti
Copy link
Contributor

@mindgraffiti mindgraffiti commented Jun 25, 2020

Ref #283

Per #308, there is a bug where the button title text was truncating. This PR fixes the truncation.

PR to test fix: wordpress-mobile/WordPress-iOS#14385

Before:
iphone_large_text

After:


button.titleLabel?.font = UIFont.preferredFont(forTextStyle: .callout)
button.titleLabel?.adjustsFontForContentSizeCategory = true
button.titleLabel?.lineBreakMode = .byWordWrapping
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought here: since you're using a xib, it would be nice to set these at design time, although, for a UIButton is less obvious, since you don't have the 'adjustsFontForContentSizeCategoryreadily available. You might still set the font and line break mode in there. You could also setadjustsFontForContentSizeCategoryin there using@ibdesignable` (which I don't think is worth) or trying to set that value as a user defined runtime attribute (but it would still be a runtime calculation). Again it's just a thought, there's nothing wrong in leaving as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okie dokie, I moved setting the font and lineBreakMode to the Interface Builder. ajustsFontForContentSizeCategory is a variable in the UIContentSizeCategoryAdjusting protocol. Protocol variables don't seem to work with @IBInspectable or @IBDesignable, so I left it as-is.

Copy link
Contributor

@ScoutHarris ScoutHarris left a comment

Choose a reason for hiding this comment

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

I agree with @Gio2018 - it'd be nice if those settings were in the xib, but not a big deal. Otherwise looks good!

@mindgraffiti mindgraffiti merged commit 2d16a62 into develop Jun 26, 2020
@mindgraffiti mindgraffiti deleted the fix/283-dynamic-text-in-button branch June 26, 2020 17:17
@mindgraffiti mindgraffiti mentioned this pull request Jun 26, 2020
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants