隐藏掉Segment默认选中的滑块白色背景/中间分割线,背景颜色
if(@available(iOS13.0, *)) {
//去掉选中滑块
self.titleSegment.selectedSegmentTintColor = [UIColor whiteColor];
// 设置背景色
[self.titleSegment setBackgroundImage:[self createImageWithColor:[UIColor colorWithHexString:@"#ffffff"]] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
//去掉分割线 (whiteimg 是我截的长度为1,高度为44的白的图片)
[self.titleSegment setDividerImage:[UIImage imageNamed:@"whiteimg"] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}else{
// Fallback on earlier versions
}
网友评论