My button's titleLabel become “…” on iOS10

前端 未结 1 1026
你的背包
你的背包 2020-12-22 01:08

When I use iOS 10 some button label\'s text become \"...\". I found the same string (e.x:我是人) in iOS9 uses 48 width. In iOS10 it uses 48.96 width. How to fix?

相关标签:
1条回答
  • 2020-12-22 01:53

    You have to use "adjustsFontSizeToFitWidth" property of titleLabel of your button

    Example:

      myButton.titleLabel.adjustsFontSizeToFitWidth = YES;
    

    This line will automatically adjust font size for the text of myButton based on the width of the button.

    Use this link: adjust UIButton font size to width

    Another solution is to increase the width of the button, by adjusting constraints.

    0 讨论(0)
提交回复
热议问题