更改UISegmentedControl的字体大小 [英] Change font size of UISegmentedControl

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

问题描述

任何人都可以告诉我如何更改 UISegmentedControl ?的字体类型和大小?

Can anyone please tell me how can I change the font type and size of UISegmentedControl?

推荐答案

我碰到了同样的问题。此代码设置整个分段控件的字体大小。类似的东西可能适用于设置字体类型。请注意,这仅适用于iOS5 +

I ran into the same issue. This code sets the font size for the entire segmented control. Something similar might work for setting the font type. Note that this is only available for iOS5+

UIFont *font = [UIFont boldSystemFontOfSize:12.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font
                                                       forKey:NSFontAttributeName];
[segmentedControl setTitleTextAttributes:attributes 
                                forState:UIControlStateNormal];

编辑: UITextAttributeFont NSFontAttributeName

这篇关于更改UISegmentedControl的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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