【问题标题】:I need very dark color for my UILabel whose background is clear我的 UILabel 需要非常深的颜色,其背景清晰
【发布时间】:2011-01-05 09:08:05
【问题描述】:
infoLabel=[[UILabel alloc]initWithFrame:CGRectMake(90,150, 200, 30)];
[infoLabel setText:@"Drag 14 more Flavors"];
[infoLabel setBackgroundColor:[UIColor clearColor]];
[infoLabel setFont:[UIFont fontWithName:@"Arial" size:17]];

[infoLabel setTextColor:[UIColor colorWithRed:1.0 green:0 blue:0 alpha:1 ]];

我使用上面的标签来获得红色,但客户说我需要更深的颜色,请帮助

【问题讨论】:

  • 如果红色不够暗,我建议黑色(不会比那个更暗)

标签: iphone uilabel uicolor


【解决方案1】:

IB 有颜色选择器,您可以在其中选择您喜欢的任何颜色,然后切换到“颜色滑块”模式以查看其实际 rgb 组件值,然后将它们放入您的代码中。例如,您可以只玩红色组件:

// This looks darker
[infoLabel setTextColor:[UIColor colorWithRed:0.5 green:0 blue:0 alpha:1 ]];

或者您可以查看常用颜色的表格(例如herehere)。 Firebrick 颜色(来自第一个链接)可能适合您的目的:

[infoLabel setTextColor:[UIColor colorWithRed:178.0/255 green:34.0/255 blue:34.0/255 alpha:1 ]];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-11
    • 2021-10-26
    • 1970-01-01
    • 1970-01-01
    • 2012-10-07
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多