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

Multiline buttons #138

Open
timautin opened this issue May 26, 2018 · 2 comments
Open

Multiline buttons #138

timautin opened this issue May 26, 2018 · 2 comments

Comments

@timautin
Copy link

When having multiline buttons, the text of the titleLabel grows outside of the button. I solved it by adding a few auto layout constraints (using a custom extension but you'll get the idea):

radioButton.titleLabel!.translatesAutoresizingMaskIntoConstraints = false;
radioButton.imageView!.translatesAutoresizingMaskIntoConstraints = false;
radioButton.constrain(soThat: .height, of: radioButton, is: .greaterThanOrEqual, to: .height, of: radioButton.titleLabel);
radioButton.constrain(soThat: .trailing, of: radioButton.titleLabel!, is: .equal, to: .trailing, of: radioButton);
radioButton.constrain(soThat: .width, of: radioButton.imageView!, is: .equal, to: radioButton.iconSize);
@nikoagge
Copy link

Or you can put all buttons in a Stackview, select Word Wrap on the Line Break each button's option and give Stackview specific width, at least that worked for me.

@timautin
Copy link
Author

Ah yes, simpler solution for those targeting iOS 9. I can't use it since I still support iOS 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants