Open im-jersh opened 6 years ago
You need to adjust the buttons size to fit the font, you can do this with the data source methods.
But even the documentation says the default implementation should size the button to fit the title PLUS some padding yet this is not the result I'm seeing. Don't mind sizing the button myself, just think the docs should be consistent with that requirement if it is in fact a requirement.
Also, if simulate padding by adding blank spaces to the beginning and end of my button title, then the issue is resolved. Definitely think this is issue is a bug that needs to be addressed internally. Can try to track it down later and submit a PR.
You're right, my bad. This does seem like a bug that should be looked into.
The code which handles this constraint for the button:
let size = buttonSize ?? self.buttonTitle?.size() ??
self.buttonImage?.size ??
CGSize(width: 0, height: 0)
button.heightAnchor.constraint(equalToConstant: size.height).isActive = true
button.widthAnchor.constraint(equalToConstant: size.width).isActive = true
I don't have time currently to look at this, but if you want to take a look and submit a PR that would be great!
It seems like setting the font size to some arbitrary value depending on the device type will cause the action button's title to be truncated.
Here's an 8 Plus with the font size set to 17pt:
And the same device with the font size set to 16pt: