У меня есть код, в котором я хочу разработать график. Код:
NSArray *coordinate = [[NSArray alloc] initWithObjects: @"42,213", @"75,173", @"108,153", @"141,133", @"174,113", @"207,73", @"240,33", nil];
CGContextSetRGBFillColor(ctx, 255, 0, 0, 1.0);
CGContextSetLineWidth(ctx, 8.0);
for(int intIndex = 0; intIndex < [coordinate count]; fltX1+=33, intIndex++)
{
CGContextMoveToPoint(ctx, fltX1+37, fltY2+18);
CGPoint point = [[coordinate objectAtIndex:intIndex] CGPointValue];
CGContextAddLineToPoint(ctx, point);
CGContextStrokePath(ctx);
}
Приведенный выше код переходит к отладчику в строке CGPoint point = [[координатный объектAtIndex: intIndex] CGPointValue].
Как я рисую линию на графике, используя приведенный выше код ????????
Теперь я изменяю приведенный выше код как поток,
Привет, прославленный хакер, я уже угадал предложение выше.
Но теперь я изменил свой код, как,
CGContextSetRGBFillColor(ctx, 255, 0, 0, 1.0);
CGContextSetLineWidth(ctx, 8.0);
NSArray *coordinate1 = [[NSArray alloc] initWithObjects:@"42",@"75",@"108",@"141",@"174",@"207",@"240",nil];
NSLog(@"The points of coordinate1: %@", coordinate1);
NSArray *coordinate2 = [[NSArray alloc] initWithObjects:@"213",@"173",@"153",@"133",@"113",@"73",@"33",nil];
for(int intIndex = 0; intIndex < [coordinate1 count], intIndex < [coordinate2 count]; fltX1+=33, intIndex++)
{
CGContextMoveToPoint(ctx, fltX1+37, fltY2+18);
NSString *arrayDataForCoordinate1 = [coordinate1 objectAtIndex:intIndex];
NSString *arrayDataForCoordinate2 = [coordinate2 objectAtIndex:intIndex];
CGContextAddLineToPoint(ctx, (float *)arrayDataForCoordinate1, (float *)arrayDataForCoordinate2);
//NSLog(@"CGPoints of drawing the bar: %@", point);
}
CGContextClosePath(ctx);
CGContextStrokePath(ctx)
Но это все равно дало мне ошибку в той же строке.