//默认选中
_segment.selectedSegmentIndex = 0;
//选择时的颜色和字体
[_segment setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName: [UIColor blueColor]} forState:UIControlStateSelected];
//未选择时的颜色和字体
[_segment setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateNormal];
//区分在那个选项
[_segment addTarget:self action:@selector(SegClick:) forControlEvents:UIControlEventValueChanged];
if (seg.selectedSegmentIndex == 0)
[如果您在阅读我的文章时有疑问 , 请点击这里](https://www.jianshu.com/p/1e68be1e6646)
网友评论