gpt4 book ai didi

ios - 按钮标题颜色

转载 作者:行者123 更新时间:2023-11-28 22:20:02 25 4
gpt4 key购买 nike

我想设置带有下划线和棕色的按钮标题:

为此我正在做:

 NSMutableAttributedString *nearestLocation = [[NSMutableAttributedString alloc] initWithString:@"Locate Manually"];
[nearestLocation addAttribute:(NSString*)kCTUnderlineStyleAttributeName
value:[NSNumber numberWithInt:NSUnderlineStyleSingle]
range:(NSRange){0,[nearestLocation length]}];
[btn_manually setAttributedTitle:nearestLocation forState:UIControlStateNormal];
[btn_manually setTitleColor:[UIColor brownColor] forState:UIControlStateNormal];

它显示下划线而不是棕色。

最佳答案

尝试这样使用....

 [nearestLocation addAttribute:NSForegroundColorAttributeName value:[UIColor brownColor] range:NSMakeRange(0,[nearestLocation length])];

关于ios - 按钮标题颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20679396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com