如何更改 UISegmentedControl 的单个索引的字体大小?

How to change the font size of a single index for UISegmentedControl?

更改 UISegmentedControl 字体大小的方法如下:

UIFont *font = [UIFont systemFontOfSize:13.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont];
[self.segment setTitleTextAttributes:attributes forState:UIControlStateNormal];

如何更改 UISegmentedControl 中单个索引的字体大小?或者更好的是,如果文本不适合 segment(而不是 "Above",它有 "Abo...")字体大小应该更小以便适合。

请尝试使用以下代码

for (UIView *v in [[[segment subviews] objectAtIndex:0] subviews]) {
    if ([v isKindOfClass:[UILabel class]]) {
        UILabel *label=(UILabel *) v ;
        lable.font=[UIFont systemFontOfSize:13.0f];
    }
}