2

The way to change the font size for a UISegmentedControl would be the following:

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

How can I change the font size for a single index in a UISegmentedControl? Or even better, if the text doesn't fit in the segment (instead of "Above", it has "Abo...") the font size should be smaller so that it can fit.

Jessica
  • 9,379
  • 14
  • 65
  • 136
  • http://stackoverflow.com/questions/13930758/multiple-lines-of-text-in-uisegmentedcontrol?answertab=votes#tab-top – Yuyutsu May 21 '15 at 05:27

1 Answers1

0

Please try with below code

for (UIView *v in [[[segment subviews] objectAtIndex:0] subviews]) {
    if ([v isKindOfClass:[UILabel class]]) {
        UILabel *label=(UILabel *) v ;
        lable.font=[UIFont systemFontOfSize:13.0f];
    }
}
Santu C
  • 2,644
  • 2
  • 12
  • 20