My button's titleLabel become “…” on iOS10

空扰寡人 提交于 2019-11-30 09:43:15

问题


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:


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.



来源:https://stackoverflow.com/questions/39422382/my-buttons-titlelabel-become-on-ios10

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!