Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
xib文件中有一个UISegmentedControl,我想在选中时更改标题颜色,怎么做?
在(iOS 5 及更高版本)中执行此操作的最简单方法是使用-setTitleTextAttributes: forState:.
-setTitleTextAttributes: forState:
例子: [segmentedControl setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor lightGrayColor] } forState:UIControlStateSelected];
[segmentedControl setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor lightGrayColor] } forState:UIControlStateSelected];
文档:UISegmentedControl 类参考