나는 "drawingViewController"라는 클래스와 뷰를 가지고 있고, 나는의 drawRect 방법이 있습니다다른 방법으로 iPhone을 그릴 수있는 방법은 무엇입니까?
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextMoveToPoint(context, 0.0f, 0.0f);
CGContextAddLineToPoint(context, 100.0f, 100.0f);
CGContextStrokePath(context);
}
을하지만 다른 그리기 방법을 정의 할 싶어하지만, 일을 did't, 어떻게 그렇게 할 수 있습니다 떨어져 drawRect 메서드를 호출 떨어져? thz 사전에.
뷰를 업데이트하려면 drawRect 메서드를 호출해야합니다. – Tattat
다시 말하면 : * 결코 당신 자신을 'drawRect :'라고 부르지 마십시오. 다른 함수를 호출하면, 프레임 워크는 당신을 위해'drawRect :'를 호출 할 것이다. –