DLRadioButton
DLRadioButton copied to clipboard
Multiline buttons
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);
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.
Ah yes, simpler solution for those targeting iOS 9. I can't use it since I still support iOS 8.