helloGo helloGo - 7 months ago 112
Objective-C Question

IOS UI Segmented Controls with an underline

I was wondering how do you do make a underline in ios segmented controls text.



This SO post may help you How to create Segmented control with underline in iOS. You may be able to do it by using attributes. Something like this:

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:@"yourtext"
                                                                      attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleNone)}]];
[_segmentedControl setTitleTextAttributes:attributedString  forState:UIControlStateNormal];