뷰에 속성이 있는 스트링 그리기 Development




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


트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://felaur.egloos.com/tb/2350045 [도움말]

덧글

덧글 입력 영역