0
drawRect 메서드를 사용하여 선 그래프를 만들려고했지만 주요 문제가 발생했습니다. iPhone 화면의 0 점이 왼쪽 상단에 있습니다. 0,0 포인트의 위치를 변경하거나 왼쪽 하단에 0,0 포인트가있는 경우 좌표 입력을 변경하는 방법이 있습니까?iPhone 픽셀 좌표 문제
을 Heres 내의 drawRect 방법
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 1.0);
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGFloat components[] = {0.0, 0.0, 1.0, 1.0};
CGColorRef color = CGColorCreate(colorspace, components);
CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);
//Coordinates of bottom left corner (480 went off screen)
CGContextMoveToPoint(context, 0, 460);
CGContextAddLineToPoint(context, 320, 0);
CGContextStrokePath(context);
CGColorSpaceRelease(colorspace);
CGColorRelease(color);
}