IOS 7 UISegmentedControl设置色调颜色不起作用

问题描述 投票:2回答:2

IOS 7 UISegmentedControl设置色调颜色不起作用。我怎么解决呢?

这是我添加的代码:

UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:[NSMutableArray arrayWithObjects:@"YES",@"NO", nil]];

[segmentControl setTintColor:[UIColor orangeColor]];

但颜色只出现在边框,我希望它为整个背景着色。

正如我从图书馆提到的,

@property(nonatomic) UISegmentedControlStyle segmentedControlStyle NS_DEPRECATED_IOS(2_0, 7_0, "The segmentedControlStyle property no longer has any effect");*
ios uisegmentedcontrol tintcolor
2个回答
0
投票

UISegmentedControl与UINavigationBar的色调颜色有关。如果更改颜色,UISegmentedControl的色调颜色将相应更改。

[[UINavigationBar appearance]  setTintColor:[UIColor blackColor]];

-4
投票

我想你可能想要:

[段控制设置背景颜色:[UIColor橙色]];

© www.soinside.com 2019 - 2024. All rights reserved.