UISegmentedControl *control = [[UISegmentedControl alloc]initWithItems:@[@"课程",@"作业"]];
control.tintColor = RGBACOLOR(74, 201, 165, 1);
control.backgroundColor = [UIColor whiteColor];
control.selectedSegmentIndex = 0;
@weakify(self);
[[control rac_signalForControlEvents:UIControlEventValueChanged] subscribeNext:^(id x) {
@strongify(self);
[self.viewModel.controlSelect sendNext:[x valueForKeyPath:@"selectedSegmentIndex"]];
NSLog(@"x===%@===%ld",[x class],[[x valueForKeyPath:@"selectedSegmentIndex"] integerValue]);
}];
control.layer.borderWidth = 1;
control.layer.cornerRadius = 5;
control.layer.borderColor = [UIColor black75PercentColor].CGColor;
control.clipsToBounds = YES;
NSMutableDictionary *textAttrs=[NSMutableDictionary dictionary];
textAttrs[NSForegroundColorAttributeName]=[UIColor orangeColor];
NSMutableDictionary *dTextAttrs=[NSMutableDictionary dictionaryWithDictionary:textAttrs];
dTextAttrs[NSForegroundColorAttributeName]=[UIColor black25PercentColor];
[control setTitleTextAttributes:dTextAttrs forState:UIControlStateNormal];
control;
});