Give spacing to customizeFontSizeToFitWidth

My problem is pretty simple. I am using adjustsFontSizeToFitWidth

with a button and it works fine, however the button has a border and there is an ugly match between the text and the border.

Is it possible to set the distance between the border of the button and the text this way?

edit: Here is a photo of my problem.

photo problem

also, a solution that doesn't use adjust the font size to fit the width, fine as long as it provides the same functionality.

+3


source to share


2 answers


Try changing contentEdgeInsets

or titleEdgeInsets

.



+1


source


The two ways you can do this are up to you.



  • Increase the size of your button. Once set adjustsFontSizeToFitWidth

    to true and the title of the button, set adjustsFontSizeToFitWidth

    back to false and then resize your button.

  • Reduce the size of your button name. By setting the adjustsFontSizeToFitWidth

    title of the button to true, set it adjustsFontSizeToFitWidth

    back to false. Now check the font size of your heading and then reduce it.

0


source







All Articles