首页 > 代码库 > UISegmentedControl 样式

UISegmentedControl 样式

_segment = [[UISegmentedControl alloc] initWithItems:@[@"aaaa", @"bbbb"]];

    [_segment setFrame:CGRectMake(20, 300, 280, 30)];

    [_segment setTintColor:[UIColor grayColor]];

    [_segment setSelectedSegmentIndex:0];

    

    _segment.layer.masksToBounds = YES;

    _segment.layer.cornerRadius = 10.0;

    _segment.layer.borderWidth = 1.0;

    _segment.layer.borderColor = [UIColor cyanColor].CGColor;

    [self.view addSubview:_segment];