gpt4 book ai didi

ios - 如何使 UIButton 文本动态化?

转载 作者:可可西里 更新时间:2023-11-01 01:37:45 26 4
gpt4 key购买 nike

所以我在堆栈 View 中有一个 UIButton。到目前为止,该按钮是动态的,并且相应地缩小了尺寸。问题是里面的文字不会根据屏幕尺寸变小。我正在使用 Storyboard和 Swift。

The way the button looks on iPhone5

最佳答案

获取按钮的 titleLabel 并将 setAdjustsFontSizeToFitWidth 设置为 YES

这是objC方式

[[button titleLabel] setAdjustsFontSizeToFitWidth:YES];

关于ios - 如何使 UIButton 文本动态化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34349385/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com