答案 0 :(得分:2)
只需将@{NSForegroundColorAttributeName : [UIColor whiteColor]}
作为UIControlStateSelected状态的文本属性
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControl;
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
NSDictionary *dict = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
[self.segmentedControl setTitleTextAttributes:dict forState:UIControlStateSelected];
}
@end