2012-02-14 14 views
0

나는 정적 X, Y 좌표와 라인을 넣어 싶어하지만 난과 높이 (x, y)부터 시작 수직선을 그리려면 몇 가지 조건그림을 그리는 방법?

-(void)drawRect:(CGRect)rect 
{ 
    AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate; 
    CGRect customPath1 = CGRectMake(35, 183, 10, delegate.breakFastTotalamt); 
    CGRect customPath2 = CGRectMake(140, 183, 10, 100); 
    UIBezierPath *path1 = [UIBezierPath bezierPathWithRect:customPath1]; 
    UIBezierPath *path2 = [UIBezierPath bezierPathWithRect:customPath2]; 
    [[UIColor greenColor]set]; 
    [path1 fill]; 
    [path2 fill]; 
} 
+0

그래서, 질문은 무엇입니까? –

+0

또한, 코드에는 두 개의 직사각형 만 표시되지만 선이나 높이는 표시되지 않습니다. – sch

+0

나는 수평선을 사용하여 수평선을 만들었습니다. 2. 나는 UIBEZIERPATH를 사용하여 다양한 선을 띄우고 싶습니다. 나는 높이 값을 데이터베이스에서 얻고 있습니다. 높이가 줄을 바꿀 때 그 버튼에 대해서. 정적 인 지점을 시작하려면 – Shreedhar

답변

0

에 accoding의 높이를 변경하려면 h, 다음과 같이 할 수 있습니다.

UIBezierPath* path = [UIBezierPath bezierPath]; 
[path moveToPoint:CGPointMake(x, y)]; 
[path addLineToPoint:CGPointMake(x, y + h)]; 
[path closePath]; 
[[UIColor greenColor] setStroke]; 
path.lineWidth = 5; // Or whatever width you want 
[path stroke]; 
+0

을 사용해야합니다. [경로 addLineToPoint : CGPointMake (x, y - h)]; – Shreedhar

관련 문제