
- (void)drawRect:(NSRect)rect {
NSString *string = @"Got Fill?";
NSMutableDictionary *stringAttributes = [NSMutableDictionary dictionary];
// Set a font and specify a "fill" color
[stringAttributes setObject: [NSFont fontWithName:@"Arial-Black" size:64] forKey: NSFontAttributeName];
[stringAttributes setObject: [NSColor whiteColor] forKey: NSForegroundColorAttributeName];
// Set a negative width so we get both stroke and fill to show
[stringAttributes setObject: [NSNumber numberWithFloat: -2.0] forKey: NSStrokeWidthAttributeName];
[stringAttributes setObject: [NSColor blackColor] forKey: NSStrokeColorAttributeName];
// Now paint the background
[[NSColor grayColor] set];
[NSBezierPath fillRect: [self bounds]];
// And finally draw the string with these attributes
[string drawAtPoint: NSMakePoint(100, 100) withAttributes: stringAttributes];
}

덧글