- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *allTouches = [touches allObjects]; if([allTouches count] >=2) { CGPoint p1 = [[allTouches objectAtIndex:0] locationInView:self]; CGPoint p2 = [[allTouches objectAtIndex:1] locationInView:self]; if(fabs(p2.y - p1.y) > 200) { [pointArr_1 release]; pointArr_1 = [[NSMutableArray alloc] init]; // [pointArr_1 removeAllObjects]; [self setNeedsDisplay]; } } else { UITouch *touch = [touches anyObject]; CGPoint pp = [touch locationInView:self]; [currentArr_1 addObject:NSStringFromCGPoint(pp)]; [self setNeedsDisplay]; [delegate touchMoved:[NSString stringWithFormat:@"%f",pp.x] andY:[NSString stringWithFormat:@"%f",pp.y]]; // NSLog(@"pp.x = %f",pp.x); if (pp.x >= viewFrameBeginX && pp.x <= viewFrameEndX) { if (pp.x > max_X) //获取最大位置 { max_X = pp.x; [widthDic setValue:[NSNumber numberWithInt:max_X] forKey:@"maxX"]; } if (pp.x < min_X) //获取最小位置 { min_X = pp.x; [widthDic setValue:[NSNumber numberWithInt:min_X] forKey:@"minX"]; } // NSLog(@"widthDic = %@",widthDic); } }