【问题标题】:Change Text Size of UISegmentedControl in iPhone [duplicate]在iPhone中更改UISegmentedControl的文本大小[重复]
【发布时间】:2012-04-24 15:06:13
【问题描述】:

可能重复:
Change font size of UISegmentedControl
how to change the font size of UISegmentedControl text?

如何更改分段控件的文本大小?

谁能帮帮我!!

【问题讨论】:

标签: iphone objective-c ios xcode ipad


【解决方案1】:

注意:这仅适用于iOS5+。

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

【讨论】:

  • UITextAttributeFont 在 iOS 7.0 中已弃用;改为使用 - NSDictionary *attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:12.0f]};
猜你喜欢
  • 2011-03-30
  • 2021-10-02
  • 2011-01-17
  • 2016-05-22
  • 1970-01-01
  • 2012-10-17
  • 2014-06-04
  • 2018-11-14
相关资源
最近更新 更多