ありがとうございましたGinamin
ありがとうございました。 座標を反転させるために何らかのビルドを作成する必要があると聞こえます。
私はそれをしました - 1. y座標の最高点と最低点を見つけてください。 2.各y点に-1を掛け、最も高い+最低点をそれに加えます。画像は正しく描画されます。
これは誰にとっても役立つコードです。
//points array for example
points = [[NSArray alloc] initWithObjects:
[NSValue valueWithCGPoint:CGPointMake(0, 0)],
[NSValue valueWithCGPoint:CGPointMake(0, 90)],
[NSValue valueWithCGPoint:CGPointMake(100, 90)],
[NSValue valueWithCGPoint:CGPointMake(100, 0)],
[NSValue valueWithCGPoint:CGPointMake(0, 0],
nil];
CGPoint point;
NSValue *val;
NSDictionary * dict;
NSMutableArray *yPoints =[[NSMutableArray alloc] initWithCapacity:[points count]];
for (int i=0; i<[points count]; ++i) {
val = [points objectAtIndex:i];
point = [val CGPointValue];
dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:point.y] forKey:@"y"];
[yPoints addObject:dict];
}
//sort the array by the y value
NSSortDescriptor * yDescriptor =
[[NSSortDescriptor alloc] initWithKey:@"y"
ascending:YES];
NSArray * descriptors =
[NSArray arrayWithObjects:yDescriptor, nil];
NSArray * sortedArray =
[yPoints sortedArrayUsingDescriptors:descriptors];
//get the first and last points from the sorted array
yFactorHighest = [[[sortedArray lastObject] objectForKey:@"y"] intValue];
yFactorlowst = [[[sortedArray objectAtIndex:0] objectForKey:@"y"] intValue];
[yDescriptor release];
[yPoints release];
と描画機能 -
- (void) playback:(NSString*)letter
{
NSUInteger pointsCount = [points count]-1;
// Render the current path
val1 = [points objectAtIndex:p];
point1 = [val1 CGPointValue];
point1.y=-(p1.y)+yFactorHighest+yFactorlowst;
val2 = [points objectAtIndex:p+1];
point2 = [val2 CGPointValue];
point2.y=-(p2.y)+yFactorHighest+yFactorlowst;
[self renderLineFromPoint:point1 toPoint:point2];
p++;
if(p<pointsCount)
[self performSelector:@selector(playback:) withObject:@"a" afterDelay:0.1];
}
プログラミングイム新しいので、私は私のコードに問題がない願っています。 はそれだけで逆さまに、または上下逆さまにして後方描かれているように
シャニー
を助けることを願っていますか? – genpfault