【问题标题】:IOS 7 UISegmentControl set tint color not workingIOS 7 UISegmentControl设置色调颜色不起作用
【发布时间】:2019-07-29 05:00:45
【问题描述】:

IOS 7 UISegmentControl 设置色调颜色不起作用。 我将如何解决它?

这是我的添加代码:

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");*

【问题讨论】:

  • iOS7 受 Apple 的保密协议约束。问题可能会被关闭。
  • @Jeremy Stackoverflow 不会强制执行 NDA:meta.stackexchange.com/questions/94465/…
  • 你是对的。读者会的。
  • 如果我错了,请纠正我,UISegmentcontrol setTintColor 在 IOS6 中可用,它在我的应用程序中运行良好,但现在我升级到 IOS7 测试版,它的行为有点奇怪,颜色用完了,只出现在边境。我只是想让它显示出来就像它在 IOS6 中显示的那样。
  • 我的代码被修改了,可以审核吗?

标签: ios uisegmentedcontrol tintcolor


【解决方案1】:

UISegmentedControl 与 UINavigationBar 的色调有关。 如果改变颜色,UISegmentedControl 的 tint 颜色也会随之改变。

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

【讨论】:

    【解决方案2】:

    我想你可能想要:

    [segmentControl setBackgroundColor:[UIColor orangeColor]];

    【讨论】:

    • 不,这与 tint color -1 不同
    猜你喜欢
    • 1970-01-01
    • 2014-09-21
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    • 1970-01-01
    • 1970-01-01
    • 2013-09-28
    • 2019-08-23
    相关资源
    最近更新 更多