【问题标题】:Changing the font for selected segment in uisegmentedcontrol更改 uisegmentedcontrol 中选定段的字体
【发布时间】:2012-05-12 06:09:51
【问题描述】:

我注意到在我的一个分段控件上,很难看出选择了哪个分段。我在想我可以加粗字体,或者稍微增加字体大小。我正在尝试这个,但它不起作用:

UIFont *boldFont = [UIFont boldSystemFontOfSize:16.0];
    NSDictionary *fontDict = [[NSDictionary alloc] initWithObjectsAndKeys:boldFont, UITextAttributeFont, nil];
    [_tableSegmentedControl setTitleTextAttributes:fontDict forState:UIControlStateSelected];

我的文本在段控件的两个段中看起来相同。我需要做这样的事情吗? Change textColor in UISegmentedcontrol

如果可能的话,我希望在 iOS 5 中使用更简单的方法并添加外观。谢谢。

【问题讨论】:

标签: iphone uiview uilabel uisegmentedcontrol


【解决方案1】:

我不确定,但我认为 [UIFont boldSystemFontOfSize:16.0f]; f 不见了。试试这个然后告诉我

还 NSlog 字典的值以检查该值是否设置正确

别用

NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont]; 这我见过一些问题是由于这个。我不知道这是为什么。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-15
    • 2013-12-06
    • 2011-01-17
    • 1970-01-01
    • 2017-05-23
    • 2012-12-21
    • 2011-10-03
    相关资源
    最近更新 更多