简体   繁体   English

如何在段控制器中仅为选定的段索引设置颜色

[英]how to set color for only selected segment index in segment controller

I have a UISegment controller,In this controller I want to change the selected segment controller tab color to orange.Other tab will be normal gray color. 我有一个UISegment控制器,在这个控制器中我想将选定的段控制器选项卡颜色更改为橙​​色。其他选项卡将是正常的灰色。 Please help me how to achieve this. 请帮我解决这个问题。

Simple way to get this using UISegmentedControl appearance 使用UISegmentedControl appearance获得此功能的简单方法

[[UISegmentedControl appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                         [UIColor orangeColor],UITextAttributeTextColor, nil]
                                               forState:UIControlStateSelected];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM