如何使 UIButton 文本动态化?
How to make the UIButton Text dynamic?
所以我在堆栈视图中有一个 UIButton
。到目前为止,该按钮是动态的,并且相应地缩小了尺寸。问题是里面的文字不会根据屏幕尺寸变小。我正在使用故事板和 Swift.
获取按钮的titleLabel并setAdjustsFontSizeToFitWidth
到YES
。
这是 objC 的方式
[[button titleLabel] setAdjustsFontSizeToFitWidth:YES];
所以我在堆栈视图中有一个 UIButton
。到目前为止,该按钮是动态的,并且相应地缩小了尺寸。问题是里面的文字不会根据屏幕尺寸变小。我正在使用故事板和 Swift.
获取按钮的titleLabel并setAdjustsFontSizeToFitWidth
到YES
。
这是 objC 的方式
[[button titleLabel] setAdjustsFontSizeToFitWidth:YES];