我需要通过编程方式设置UIButton标题UILabel的字体大小。


当前回答

这应该能让你振作起来

[btn_submit.titleLabel setFont:[UIFont systemFontOfSize:14.0f]];

其他回答

您还可以自定义按钮字体粗体,斜体。 本例采用系统粗体字体大小。

[LoginButton.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f*Ratio]];
button.titleLabel.font = [UIFont systemFontOfSize:size];

应该帮助

这应该能让你振作起来

[btn_submit.titleLabel setFont:[UIFont systemFontOfSize:14.0f]];

objective - c:

[button.titleLabel setFont: [button.titleLabel.font fontWithSize: sizeYouWant]];

迅速:

button.titleLabel?.font = button.titleLabel?.font.fontWithSize(sizeYouWant)

只会改变字体大小。

你可以使用:

button.titleLabel.font = [UIFont systemFontOfSize:14.0];