修改UISegmentControl样式

``

  • (UISegmentedControl *)segmentedControl {
    if (!_segmentedControl) {
    _segmentedControl = [[UISegmentedControl alloc] initWithItems:@[@"全部",@"被查看",@"待沟通",@"面试",@"不合适"]];
    _segmentedControl.frame = CGRectMake(0, 64, ScreenWidth, segmentHeight);
    NSDictionary * unselectedAttributes = @{
    NSFontAttributeName:FontPingFangSC_Light(14),
    NSForegroundColorAttributeName:ColorI(0x999999)
    };
    [_segmentedControl setTitleTextAttributes:unselectedAttributes forState:UIControlStateNormal];
    NSDictionary * selectedAttribute = @{
    NSFontAttributeName:FontPingFangSC_Light(14),
    NSForegroundColorAttributeName:ColorI(0x20abff)
    };

      [_segmentedControl setTitleTextAttributes:selectedAttribute forState:UIControlStateSelected];
      _segmentedControl.tintColor = [UIColor clearColor];
      [_segmentedControl addTarget:self action:@selector(segmentedControlSelectedAction:) forControlEvents:UIControlEventValueChanged];
      _segmentedControl.backgroundColor = ColorI(0xF0F3F5);
      _segmentedControl.selectedSegmentIndex = 0;
    

    }
    return _segmentedControl;
    }

``

你可能感兴趣的:(修改UISegmentControl样式)