美文网首页
HMSegmentedControl

HMSegmentedControl

作者: Leon1024 | 来源:发表于2019-06-27 09:14 被阅读0次

HMSegmentedControl *segmented = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"已收公告",@"已发公告"]];
segmented.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; // 自动调整
segmented.frame = CGRectMake(self.view.bounds.size.width/2-100, 4, 200, 40);
segmented.backgroundColor = [UIColor clearColor];
segmented.selectionIndicatorHeight = 3.0f; // 线的高度
segmented.font = [UIFont fontWithName:@"STHeitiSC-Light" size:19.0f]; // 设置字体
segmented.textColor = WHRGB(255, 175, 185); // 字的颜色
segmented.selectedTextColor = [UIColor whiteColor]; // 选中时字体颜色
segmented.selectionIndicatorColor = [UIColor whiteColor]; //线条的颜色
segmented.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe; //线充满整个长度
segmented.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown; //线的位置
[segmented addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged];
self.segmentedControl = segmented;
[self.navigationController.navigationBar addSubview:segmented];


作者:花椰菜蘑菇猴
来源:CSDN
原文:https://blog.csdn.net/Sunshine__hui/article/details/51516350
版权声明:本文为博主原创文章,转载请附上博文链接!

相关文章

网友评论

      本文标题:HMSegmentedControl

      本文链接:https://www.haomeiwen.com/subject/kdflcctx.html