Re: Change font and text color of label which is a static NSTextField
Re: Change font and text color of label which is a static NSTextField
- Subject: Re: Change font and text color of label which is a static NSTextField
- From: Andrew Farmer <email@hidden>
- Date: Wed, 3 Jun 2009 03:35:59 -0700
On 3 Jun 2009, at 03:25, Shraddha Karwan wrote:
I want to change the color and font of a label. I used the below
method.
I get no errors but it is not updating the Label with the required
changes,
- (NSAttributedString *)setLabelFont:(NSString *)str
{
NSColor *txtColor = [NSColor redColor];
NSFont *txtFont = [NSFont boldSystemFontOfSize:12];
NSDictionary *dict = [NSDictionary
dictionaryWithObjectsAndKeys:txtFont,
NSFontAttributeName, txtColor,
NSForegroundColorAttributeName, nil];
NSAttributedString *atted = [[[NSAttributedString alloc]
initWithString:str attributes:dict] autorelease];
return atted;
}
[labelStr setAttributedStringValue:[self setLabelFont:@"Checking for
updates"]];
What is labelStr, and how are you expecting changing it to affect your
label?
Also, as a point of style, the "set" prefix should be limited to
setters. A more appropriate name for this method would be something
like "stringWithLabelAttributes".
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden