Change font size of UISegmentedControl

前端 未结 16 1855
死守一世寂寞
死守一世寂寞 2020-11-28 20:54

Can anyone please tell me how can I change the font type and size of UISegmentedControl?

16条回答
  •  孤街浪徒
    2020-11-28 21:05

    this is for objective c add your segmented control name in place of mysegmentedcontrol

    UIFont *font = [UIFont systemFontOfSize:11.0f];
    
    NSDictionary *attributes = [NSDictionary dictionaryWithObject:font
                                                                forKey:UITextAttributeFont];
    
    [mySegmentedcontrol setTitleTextAttributes:attributes                                    forState:UIControlStateNormal];
    

    hope it helps

提交回复
热议问题