2013-03-19 111 views

回答

2

解决了!

NSAttributedString文档说NSShadowAttributeName的默认值为零,但在这种情况下,按钮标题用白色阴影绘制。解决透明阴影问题:

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];