我使用带有自定义背景的标准NSButton。黑色标题颜色有白色阴影 - 我该如何删除它?
答案 0 :(得分:3)
解决!
NSAttributedString文档说NSShadowAttributeName的默认值为nil,但在这种情况下,按钮标题是用白色阴影绘制的。透明阴影解决了问题:
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.0]];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
shadow, NSShadowAttributeName, nil];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:_customTitle attributes:attrsDictionary];
[mybutton setAttributedTitle:attrString];