2013년 7월 11일 목요일

drawRect에 각종 그리기


- (void)drawRect:(NSRect)dirtyRect
{
    // 여기에 그리는 코드가 들어간다.
}

// 사각형 그리기
[[NSColor blackColorset];
NSRectFill(dirtyRect);

// 텍스트 그리기

NSString * str1 = [[NSString alloc] initWithFormat:@"Hello world %d, 100];
NSMutableDictionary * str_attributes = [[NSMutableDictionary alloc] init];
[str_attributes setObject:[NSColor blueColor] forKey:NSForegroundColorAttributeName];
[str drawAtPoint:NSMakePoint(100,100) withAttributes:str_attributes];
[str release];

댓글 없음:

댓글 쓰기