Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (20 sloc) 0.718 kb
//
// LastifyDrawerButton.m
// Lastify
//
// Created by George on 11/02/2009.
// Based on code by Matt Gemmell: http://www.pastebuffer.com/2007/10/04/setting-the-text-color-of-an-nsbutton/
//
#import "NSButton+Lastify.h"
@implementation NSButton (Lastify)
- (void)setTextColor:(NSColor *)textColor
{
NSMutableAttributedString *attrTitle = [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTitle]];
int len = [attrTitle length];
NSRange range = NSMakeRange(0, len);
[attrTitle addAttribute:NSForegroundColorAttributeName value:textColor range:range];
[attrTitle fixAttributesInRange:range];
[self setAttributedTitle:attrTitle];
[attrTitle release];
}
@end
Jump to Line
Something went wrong with that request. Please try again.