UISegmentedControl字体大小,背景色

_headerSegment = [[UISegmentedControl alloc]initWithItems:@[@"快销品",@"滞销品"]];

_headerSegment.frame = CGRectMake(-3, -1, SCREEN_WIDTH + 6, 43);

UIFont *font = [UIFont systemFontOfSize:16.0f];

NSDictionary *attributes = [NSDictionary dictionaryWithObject:font

forKey:NSFontAttributeName];

UIColor *whiteColor = [UIColor whiteColor];

_headerSegment.tintColor = whiteColor;

_headerSegment.backgroundColor = [UIColor greenColor];

_headerSegment.selectedSegmentIndex = 0;

[_headerSegment setTitleTextAttributes:attributes forState:UIControlStateNormal];

[self.view addSubview:_headerSegment];

[_headerSegment addTarget:self action:@selector(segmentSelect:) forControlEvents:UIControlEventValueChanged];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容