Nel tutorial di oggi imparerete come cambiare il colore del testo di un NSButton con Objective C.

 
- (void)setButtonTitleFor:(NSButton*)button toString:(NSString*)title withColor:(NSColor*)color {
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
[style setAlignment:NSCenterTextAlignment];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
color, NSForegroundColorAttributeName, style, NSParagraphStyleAttributeName, nil];
NSAttributedString *attrString = [[NSAttributedString alloc]
initWithString:title attributes:attrsDictionary];
[button setAttributedTitle:attrString];
[style release];
[attrString release];
}
 

fonte: www.sastgroup.com ? Vai al post originale