如何将所有UIButton字体更改为自定义字体? [英] How to change all UIButton fonts to custom font?

查看:149
本文介绍了如何将所有UIButton字体更改为自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法做到这一点?
我想有一个自定义的字体,我已经下载,以显示在UIButton。

解决方案

如果您使用 IBOutletCollection 然后这应该是直接的。

  @property(nonatomic,retain )IBOutletCollection(UIButton)NSArray * buttons; 

将按钮连接到此插座集合,稍后使用

  [self setValue:[UIFont fontWithName:@Helveticasize:30] forKeyPath:@buttons.font]; 


Is there any way to do this? I want to have a custom font that I've downloaded to show on ever UIButton.

解决方案

If you use IBOutletCollection then this should be direct.

@property (nonatomic, retain) IBOutletCollection(UIButton) NSArray *buttons;

Connect the buttons to this outlet collection and later alter the font in a single shot using,

[self setValue:[UIFont fontWithName:@"Helvetica" size:30] forKeyPath:@"buttons.font"];

这篇关于如何将所有UIButton字体更改为自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆