【发布时间】:2015-11-16 07:06:51
【问题描述】:
我为我的 UISegmentedControl 设置了自定义字体,但它似乎禁用了默认的 autoAdjustFontSizeToFitWidth 参数。
这是我用于设置自定义字体的代码:
UISegmentedControl *segmentedControl = (UISegmentedControl *)subview;
UIFont *font = [UIFont fontWithName:DEFAULT_FONT size:DEFAULT_FONT_SIZE];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
[segmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
有办法保存吗?非常感谢。
编辑:我想避免
segmentedControl.apportionsSegmentWidthsByContent = YES;
如果可能,每个段的宽度始终相同。
【问题讨论】:
-
没有 autoAdjustFontSizeToFitWidth 这样的东西。您是否正确设置了属性?
-
我的意思是 autoAdjustFontSizeToFitWidth 像 UILabel 属性。我想找一个这样的属性,但要针对一个细分市场。
标签: ios objective-c uisegmentedcontrol