2010-06-14 5 views
0

mandelbrot 집합에 있는지 계산 한 후 개별 픽셀 (직사각형)을 그리는 UIView 하위 클래스를 업데이트하려고합니다. 나는 하나 개의 픽셀을 표시하는 방법을 파악하면, 내가 좋아하는 것UIView 하위 클래스 내용 업데이트

//drawingView.h 

... 

-(void)drawRect:(CGRect)rect{ 

    CGContextRef context = UIGraphicsGetCurrentContext(); 

    CGContextSetRGBFillColor(context, r, g, b, 1); 
    CGContextSetRGBStrokeColor(context, r, g, b, 1); 

    CGRect arect = CGRectMake(x,y,1,1); 


    CGContextFillRect(context, arect); 

} 
... 

//viewController.m 
... 
- (void)viewDidLoad { 
    [drawingView setX:10]; 
    [drawingView setY:10]; 
    [drawingView setR:0.0]; 
    [drawingView setG:0.0]; 
    [drawingView setB:0.0]; 
    [super viewDidLoad]; 
    [drawingView setNeedsDisplay]; 
} 

다른를 추가하여보기를 업데이트하는 방법에 대한 이동하는 방법을 알고 : 나는 다음과 같은 코드를 사용하고 있지만 빈 화면을 얻고있다

픽셀 (한번 계산). 모든 변수가 변경되면 어떻게 현재보기를 그대로 유지하지만 다른 픽셀을 추가합니까?

감사합니다, 브렛

답변

0
CGContextMoveToPoint(context, xcoord, ycoord); 
CGContextAddLineToPoint(context, xcoord, ycoord); 
CGContextStrokePath(context);